Skip to content

Conversation

@PromoFaux
Copy link
Member

What does this PR aim to accomplish?:

Builds upon #3655 and uses the newly published earliest_timestamp_disk to set the earliest possible date in the daterangepicker.

Due to an issue in the new daterangepicker library, there is a cosmetic issue which is fixed with a locally applied patch temporarily. This can be removed if/when the vendor integrates the upstream PR Wernfried/daterangepicker#1


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)

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

@PromoFaux PromoFaux requested a review from a team as a code owner November 9, 2025 23:25
@PromoFaux PromoFaux force-pushed the luxon-earliest-query branch 3 times, most recently from 6c1337b to b959f44 Compare November 9, 2025 23:50
Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

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

Image

// earliest_timestamp is provided in seconds since epoch
beginningOfTime = Number(data.earliest_timestamp_disk);
// Round down to nearest 5-minute segment (300 seconds)
beginningOfTime = Math.floor(beginningOfTime / 300) * 300;
Copy link
Member

Choose a reason for hiding this comment

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

Could also work with luxon toRelative using the rounding and padding options

https://moment.github.io/luxon/api-docs/index.html#datetimetorelative

@yubiuser
Copy link
Member

Unrelated to your changes: the end month selector does not stick
Peek 2025-11-10 08-51

@rdwebdesign
Copy link
Member

I also found a strange issue:

If you select a time range like "This month" and then you select "Custom Range", the selection should show the current month with all days selected until Today, but this is what I see:

strange_selection

@yubiuser
Copy link
Member

Two reported issues have been fixed upstream. I'll update the vendor files in my branch

…PI and update date picker accordingly.

We use the on-disk earliest timestamp to get the complete range.

Signed-off-by: Adam Warner <[email protected]>
@PromoFaux PromoFaux force-pushed the luxon-earliest-query branch 4 times, most recently from 5660e60 to e765677 Compare November 12, 2025 23:00
… use whichever of the two timestamps is smallest (and non-zero)

Signed-off-by: Adam Warner <[email protected]>
Signed-off-by: Adam Warner <[email protected]>
@PromoFaux PromoFaux force-pushed the luxon-earliest-query branch from e765677 to ee39167 Compare November 12, 2025 23:08
@PromoFaux PromoFaux changed the title Set "All Time " range for query log datepicker based on Database ranges Set "All Time " range for query log datepicker based on Database ranges (luxon) Nov 12, 2025
// We initialize them as null and populate them during page init.
let beginningOfTime = null; // seconds since epoch (set from API: info/database.earliest_timestamp)
// endOfTime should be the start of tomorrow in seconds since epoch
// We don't use 23:59:59 as the picker increments are set to 5 minutes
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// We don't use 23:59:59 as the picker increments are set to 5 minutes
// We don't use 23:59:59 (endOf("day")) as the picker increments are set to 5 minutes

if (beginningOfTime === null) {
$("#querytime").prop("disabled", true);
$("#querytime").addClass("disabled");
$("#querytime-note").text("No data in the database");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$("#querytime-note").text("No data in the database");
$("#querytime-note").text("ℹ️ No data in the database");

endDate: luxon.DateTime.fromMillis(until * 1000), // convert to milliseconds since epoch
locale: {
format: dateformat,
firstDay: 7,
Copy link
Member

Choose a reason for hiding this comment

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

This might be a British thing, but my week starts on Monday

Suggested change
firstDay: 7,
firstDay: 1,

"Last Hour": [now.minus({ hours: 1 }), now],
Today: [now.startOf("day"), maxDateDt],
Yesterday: [now.minus({ days: 1 }).startOf("day"), now.minus({ days: 1 }).endOf("day")],
"Last 7 Days": [now.minus({ days: 6 }), maxDateDt],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Last 7 Days": [now.minus({ days: 6 }), maxDateDt],
"Last 7 Days": [now.minus({ days: 6 }).startOf("day"), maxDateDt],

Today: [now.startOf("day"), maxDateDt],
Yesterday: [now.minus({ days: 1 }).startOf("day"), now.minus({ days: 1 }).endOf("day")],
"Last 7 Days": [now.minus({ days: 6 }), maxDateDt],
"Last 30 Days": [now.minus({ days: 29 }), maxDateDt],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Last 30 Days": [now.minus({ days: 29 }), maxDateDt],
"Last 30 Days": [now.minus({ days: 29 }).startOf("day"), maxDateDt],

@yubiuser yubiuser mentioned this pull request Nov 20, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants