Date fields to only take date strings and not date objects #8878
anthony-dandrea
started this conversation in
Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Mantine v8 introduced two relevant breaking changes:
onChangeprop use a string instead of aDateobject.This removed a ton of timezone complexity on Mantine's side. However, these props still leverage
DateValuewhich includes both the date string and date object:minDatemaxDatevaluedefaultValueAnd I think the inconsistency can lead to confusing behavior. Especially for apps using Mantine that need to use a specific timezone that the user's machine isn't set to.
My Thoughts
I believe it'd be a more clear API if the date fields only accepted date strings. And never date objects for any of their props.
This sandbox illustrates the scenario and how it could bite someone. And the non-intuitive(IMO) steps needed to work around this use case.
https://codesandbox.io/p/devbox/mantine-date-minmax-repro-forked-jwrwpc?workspaceId=ws_9DEenomYG9hvRej8SwUPgy
Argument Against
onChangeso I don't think it's that bad.Thanks!
I appreciate the work done on this library. It's been a real treat to use.
Beta Was this translation helpful? Give feedback.
All reactions