Drop moment.js for luxon.js
What does this PR aim to accomplish?:
This PR initially only tried to replace https://github.com/dangrossman/daterangepicker which has been unmaintained for >5 years now. I found a active fork at https://github.com/Wernfried/daterangepicker which had the nice side effect that it replaced moment.js (also in maintenance mode) mode with its successor luxon (https://moment.github.io/luxon). I swapped all the libraries and adjusted the code. Not all date/time format could be translated 1:1 but it's close.
It was quite straight forward, but one moment.js function (toHuman()) did not work in luxon.js (with millisecond input it would not translate to human readable output but keep in miliseconds). There is a long-standing luxon bug (https://github.com/moment/luxon/issues/1134) which provided a nice workaround with a wrapper function. I added it, but it required to load luxon.js already in header.lp (opposed to header_authenticated).
By submitting this pull request, I confirm the following:
- I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
- I have commented my proposed changes within the code and I have tested my changes.
- I am willing to help maintain this change if there are issues with it later.
- It is compatible with the EUPL 1.2 license
- I have squashed any insignificant commits. (
git rebase) - I have checked that another pull request for this purpose does not exist.
- I have considered, and confirmed that this submission will be valuable to others.
- I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
- I give this submission freely, and claim no ownership to its content.
- [x] I have read the above and my PR is ready for review. Check this box to confirm
Ready for review and testing
I did not implement any of the new features https://github.com/Wernfried/daterangepicker would offer. This could be implemented in a follow-up PR.
While using this PR as a base for implementing the new constrained "All Time" range, I found a bug in the daterangepicker fork, and have submitted a PR upstream to get it fixed
https://github.com/Wernfried/daterangepicker/pull/1/files
This pull request has conflicts, please resolve those before we can evaluate the pull request.
Merge conflicts should resolve once we incorporate https://github.com/pi-hole/web/pull/3656
Conflicts have been resolved.