Skip to content

Conversation

@yubiuser
Copy link
Member

@yubiuser yubiuser commented Nov 9, 2025

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 (moment/luxon#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:

  1. 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.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@yubiuser yubiuser force-pushed the luxon branch 3 times, most recently from 1a9b991 to 99d6917 Compare November 9, 2025 14:01
@yubiuser yubiuser marked this pull request as ready for review November 9, 2025 21:44
@yubiuser yubiuser requested a review from a team as a code owner November 9, 2025 21:44
@yubiuser
Copy link
Member Author

yubiuser commented Nov 9, 2025

Ready for review and testing

@yubiuser
Copy link
Member Author

yubiuser commented Nov 9, 2025

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.

@yubiuser yubiuser requested a review from Copilot November 9, 2025 21:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request replaces the Moment.js library with Luxon for date/time handling in the Pi-hole Web Interface. The change includes updating Chart.js adapters and removing source map files for vendor libraries.

Key Changes

  • Library Migration: Replaces Moment.js with Luxon for date/time operations
  • Chart.js Adapter Update: Switches from chartjs-adapter-moment to chartjs-adapter-luxon
  • Source Map Cleanup: Removes source map files for moment.js, daterangepicker, and chartjs-adapter-moment

Reviewed Changes

Copilot reviewed 7 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vendor/moment/* Removes all Moment.js library files (JS and map files)
vendor/chartjs-adapter-moment/* Removes Moment.js-based Chart.js adapter files
vendor/chartjs-adapter-luxon/chartjs-adapter-luxon.umd.min.js Adds Luxon-based Chart.js adapter (new file)
vendor/daterangepicker/*.map Removes source map files for daterangepicker
vendor/daterangepicker/daterangepicker.min.css Adds jsDelivr CDN attribution header
scripts/lua/header.lp Adds luxon.min.js script include
scripts/lua/header_authenticated.lp Replaces moment.js and chartjs-adapter-moment with chartjs-adapter-luxon

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PromoFaux
Copy link
Member

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

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants