Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions runtime/pkg/rilltime/rilltime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ func TestEval_Misc(t *testing.T) {
{"3W18D23h as of latest-3Y", "2022-04-04T07:32:36Z", "2022-05-14T06:32:36Z", timeutil.TimeGrainWeek, 1, 1},

{"7D as of latest/D+1D offset -1M", "2025-04-08T00:00:00Z", "2025-04-15T00:00:00Z", timeutil.TimeGrainDay, 1, 1},

// MTD with truncating to month
{"MTD as of now/M", "2025-05-01T00:00:00Z", "2025-05-01T00:00:00Z", timeutil.TimeGrainMillisecond, 1, 1},
{"MTD as of latest/M+1M", "2025-06-01T00:00:00Z", "2025-06-01T00:00:00Z", timeutil.TimeGrainMillisecond, 1, 1},
}

runTests(t, testCases, now, minTime, maxTime, watermark, nil)
Expand Down
10 changes: 10 additions & 0 deletions web-common/src/components/date-picker/Day.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
): OverlapType | undefined {
const evaluatedInterval = potentialInterval ?? interval;

const isZeroInterval = evaluatedInterval.start.equals(
evaluatedInterval.end,
);
// Safeguard for zero intervals. Show as a full circle for the relevant day only.
if (isZeroInterval) {
return areSameDay(evaluatedInterval.start, date)
? OverlapType.FULL_INTERVAL
: undefined;
}

if (areSameDay(evaluatedInterval.start, date)) {
if (areSameDay(evaluatedInterval.end.minus({ millisecond: 1 }), date))
return OverlapType.FULL_INTERVAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
let anchorDay: DateTime<true> | undefined = undefined;

$: startDate = inputInterval?.start;
$: endDate = inputInterval.end.minus({ millisecond: 1 });
// Do not deduct 1ms if the interval is of zero length to avoid having end before start.
$: isZeroInterval = inputInterval?.start.equals(inputInterval.end);
$: endDate = isZeroInterval
? inputInterval?.end
: inputInterval?.end.minus({ millisecond: 1 });

$: adjustedMinDate = minDate?.startOf("day");
$: adjustedMaxDate = maxDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@
minTimeGrain={V1TimeGrainToDateTimeUnit[
smallestTimeGrain ?? V1TimeGrain.TIME_GRAIN_MINUTE
]}
{maxDate}
{minDate}
{maxDate}
onApply={() => {
if (searchValue) handleRangeSelect(searchValue);
}}
Expand Down
Loading