-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date format doesn't appear to be used/applied #2403
Comments
so this is a bug? in previous version v4 i used like this
in latest version (v6) it doesn't work even when trying code something like
I'm confused |
Hello. Please try your config with this stackblitz. I believe I've fixed this in the There was an issue with the docs and the I've changed hooksinputFormat
Accepts: Whenever the picker attempts to set the input value from a selection, it will call this function. An example that would set the value to an ISO string. Obviously, it's up to you how you want the results to be displayed.
inputParse
Accepts: Whenever the input value changes, this function will be called. The most simple example is just to attempt to parse the string.
|
I tried your example, and hit an error. When I've cleared the contents of the textbox after it has previously held a date, I get an error about |
There's an issue somewhere in there too. I have no options set for the following explanation. If I type into the field |
I could add a check internally for an empty value, but I would think it would be up to the function to check that first and return an empty string. Otherwise, if you wanted to force a value on empty.. I guess you could listen to the change function. For you second issue, I think is because I provide a basic input format based on the selected components and then use Intl to format the date. E.g. |
I think you're right, that makes sense that it'd up to the implementation of |
The issue I was trying to describe is that, when typing a custom date (like "sept 1, 2021"), it gets parsed and then formatted as "09/01/2021, 12:00 AM", totally fine. But if I then delete the textbox's contents, and type in the same date "sept 1, 2021", it tries to parse it, but doesn't call |
Hello. Please check the preview branch again. That stackblitz should still work, though you might have to clear your cache. Originally there was code to ignore the change if the dates evaluated to the same. I've changed this a bit so it will still update the input field regardless. |
Yup, it seems to be working now, and applies the format even if it's for the same date. I did have to clear/disable caching to get it to update to the most recent version. |
Trying to customize the date control to use a custom format. For example to get a date to look like "Sept 15, 2021". However, after picking the date, it shows as "9/15/2021". Doesn't seem like it's using the custom date format at all. Not entirely sure if I'm using the correct options to specify a format, but I used the documentation as much as possible to get this far.
https://stackblitz.com/edit/js-aqvqwe?file=index.js
The text was updated successfully, but these errors were encountered: