- My goal: I want to forbid choosing a date in the future
- Issue: MaxDate still allows tomorrow even if I pass today as MaxDate
Screenshots:
Hi @pavelgur,
I applied the max date validation in my app and it’s working perfectly. It might be a bug on your end—try using {{ moment() }}
instead of {{ new Date() }}
.
Let me know if you need any further assistance!
That’s strange — it’s working fine on my end with both {{ moment() }}
and {{ new Date() }}
. The timestamp in your screenshot (2025-07-15T10:01:57.970Z
) is in UTC, so this might be a timezone issue. I suggest checking your app’s timezone settings.
Not sure there's such thing as app timezone settings. If you know where it is, let me know. Thanks.
Hey @pavelgur,
I was able to reproduce the issue by changing the timezone.
Here's a reference showing how you can display the value in a different timezone:
You can adjust the timezone based on your use case using this approach, which should help avoid the +1 day date selection issue.
Hi @pavelgur, the timezone settings are available from the Date Time component, which you could tie to your calendar input. However I'm not sure if that would affect your calendar's max date.
I don't know why your max date is one day off, but if it is consistently one day off, then you could just subtract a day off of the current date: moment().subtract(1, 'days')
.
I found out that that the error depends on time zone of the user, so subtracting will not work for everyone.
Maybe you could use moment().utcOffset()
, which gives the amount of minutes off from UTC, so that the function uses that timezone. Something like: moment().subtract(moment().utcOffset(), 'minutes')