Skip to content

Commit

Permalink
[IMPROVEMENT] Replace Moment with Luxon #375
Browse files Browse the repository at this point in the history
Replaces Moment with Luxon. The benefit of this is to have a simpler library with less magic and an immutable API as well as a minor performance improvement.
  • Loading branch information
kfdm authored Dec 8, 2021
2 parents 36ccd14 + 58d5527 commit 01be464
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 2,439 deletions.
7 changes: 3 additions & 4 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ contributors:
* License: licenses/LICENSE.jquery.mit.txt (MIT License)
* Homepage: https://jquery.org/


This product contains Moment.js, distributed by JS Foundation and other
This product contains Luxon, distributed by JS Foundation and other
contributors:

* License: licenses/LICENSE.moment.mit.txt (MIT License)
* Homepage: http://momentjs.com/
* License: licenses/LICENSE.luxon.mit.txt (MIT License)
* Homepage: https://moment.github.io/luxon/

This product contains Vue.js, distributed by Yuxi (Evan) You and other
contributors:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) JS Foundation and other contributors
Copyright 2019 JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
Empty file modified promgen/static/js/bootstrap-switch.min.js
100755 → 100644
Empty file.
Empty file modified promgen/static/js/jquery.selection.js
100755 → 100644
Empty file.
663 changes: 0 additions & 663 deletions promgen/static/js/locales.min.js

This file was deleted.

1 change: 1 addition & 0 deletions promgen/static/js/luxon.min.js

Large diffs are not rendered by default.

1,216 changes: 0 additions & 1,216 deletions promgen/static/js/moment-with-locales.min.js

This file was deleted.

551 changes: 0 additions & 551 deletions promgen/static/js/moment.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions promgen/static/js/promgen.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ Vue.filter("urlize", function (value) {
return linkifyStr(value);
});

Vue.filter("time", function (value, fmtstr = "YYYY-MM-DD HH:mm:ss") {
return moment(value).format(fmtstr);
Vue.filter("time", function (value, fmtstr = "yyyy-MM-dd HH:mm:ss") {
return luxon.DateTime.fromISO(value).toFormat(fmtstr);
});

Vue.component("promql-query", {
Expand Down
Empty file modified promgen/static/js/vue.min.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion promgen/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<script src="{% static 'js/jquery.selection.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/bootstrap3-typeahead.min.js' %}"></script>
<script src="{% static 'js/moment.min.js' %}"></script>
<script src="{% static 'js/bootstrap-switch.min.js' %}"></script>
<script src="{% static 'js/luxon.min.js' %}"></script>
<script src="{% static 'js/linkify.min.js' %}"></script>
<script src="{% static 'js/linkify-string.min.js' %}"></script>
<script src="{% static 'js/vue.min.js' %}"></script>
Expand Down
2 changes: 1 addition & 1 deletion promgen/templates/rest_framework/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script src="{% static 'js/jquery.selection.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/bootstrap3-typeahead.min.js' %}"></script>
<script src="{% static 'js/moment.min.js' %}"></script>
<script src="{% static 'js/luxon.min.js' %}"></script>

<script src="{% static 'rest_framework/js/ajax-form.js' %}"></script>
<script src="{% static 'rest_framework/js/csrf.js' %}"></script>
Expand Down

0 comments on commit 01be464

Please sign in to comment.