You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: WDS date picker marks the Minimum Date / Maximum Date itself as invalid #42508
In the WDS (Anvil) date picker, picking the date that equals Minimum Date or Maximum Date shows "Please select a valid date", even though the calendar lets you pick it.
Two causes in app/client/src/widgets/wds/WDSDatePickerWidget/widget/derived.js:
The bounds check is exclusive: isBetween without an inclusivity argument, and isAfter / isBefore.
The validator parses min/max with new Date() (a date-only string like 2023-01-01 becomes UTC midnight) while the picker parses the same value with moment() (local midnight). Which end breaks depends on the browser time zone: in IST the minimum fails, in New York the maximum fails, in UTC both do.
#10795 and #35969 are about the older DatePickerWidget2, so this looks separate.
Steps To Reproduce
Add a WDS date picker, Time Precision = Day, Minimum Date = 2023-01-01
Pick 1 Jan 2023
The widget shows "Please select a valid date"
Environment
Release
Severity
Low (Cosmetic or minor issue)
Proposed approach
Parse min, max and the selected date with moment() and compare inclusively at the widget's timePrecision (isBetween(..., "[]"), isSameOrAfter, isSameOrBefore), the same way DatePickerWidget2's isValidDate does. I have this with tests in derived.test.ts (passing under UTC, Asia/Kolkata and America/New_York) and would like to be assigned.
I've investigated the validation logic in WDSDatePickerWidget/widget/derived.js and identified two potential causes:
Exclusive date-boundary comparisons.
Inconsistent date parsing between JavaScript Date and Moment.js, causing timezone-dependent validation issues.
I propose fixing these using consistent Moment.js parsing and inclusive comparisons, along with regression tests covering boundary dates and different time zones.
The WDS DatePicker currently marks the Minimum Date and Maximum Date themselves as invalid, even though they are selectable in the calendar.
This appears to be caused by two issues in derived.js:
The date range validation uses exclusive comparisons (isBetween, isAfter, and isBefore), which incorrectly exclude the boundary dates.
The validator uses JavaScript's new Date() to parse the minimum and maximum dates, while the date picker uses moment(). This can cause timezone inconsistencies, particularly when handling date-only values.
My proposed solution:
Use moment() consistently to parse the minimum date, maximum date, and selected date.
Make the boundary comparisons inclusive using isBetween(..., "[]"), isSameOrAfter(), and isSameOrBefore().
Respect the widget's timePrecision while performing date comparisons.
Add or update unit tests in derived.test.ts to verify the behavior across different timezones, including UTC, Asia/Kolkata, and America/New_York.
Before proceeding, I would appreciate your approval to work on this issue.
Also, could you please confirm whether anyone is already working on it or if it is available to be picked up?
Activity
linear-code commentedon Oct 28, 2026
APP-16348
amiourkush commentedon Oct 31, 2026
Hi @contributor-support,
I'd like to work on this issue.
I've investigated the validation logic in
WDSDatePickerWidget/widget/derived.jsand identified two potential causes:I propose fixing these using consistent Moment.js parsing and inclusive comparisons, along with regression tests covering boundary dates and different time zones.
Could you please assign this issue to me?
Thanks!
VCDhyan commentedon Nov 10, 2026
Hi @Abhishek-B-R
I would like to work on this issue.
My understanding of the problem:
The WDS DatePicker currently marks the Minimum Date and Maximum Date themselves as invalid, even though they are selectable in the calendar.
This appears to be caused by two issues in
derived.js:isBetween,isAfter, andisBefore), which incorrectly exclude the boundary dates.new Date()to parse the minimum and maximum dates, while the date picker usesmoment(). This can cause timezone inconsistencies, particularly when handling date-only values.My proposed solution:
moment()consistently to parse the minimum date, maximum date, and selected date.isBetween(..., "[]"),isSameOrAfter(), andisSameOrBefore().timePrecisionwhile performing date comparisons.derived.test.tsto verify the behavior across different timezones, including UTC, Asia/Kolkata, and America/New_York.Before proceeding, I would appreciate your approval to work on this issue.
Also, could you please confirm whether anyone is already working on it or if it is available to be picked up?
Thank you!