-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Format ignored for datetime widget when date and time format specified #7250
Comments
I'm having this issues as well. Since I'm setting up Decap for the first time I'm not sure if this was a new bug or just incorrectly documented. It doesn't seem that any of formatting properties work according to the documentation:
When I remove all 3 properties the default format is not the correct time (e.g. 2006-01-02T15:04:05.000Z). The Decap default has the "Z" literal purporting to be UTC but the hours were not converted from my local time (-07:00). I would recommend using: |
I'm seeing the same behavior. Does the UI reflect your I have all three values set up in NetlifyCMS (Euro-style UI, ISO-like storage), where they seem to coexist without issue. Did I get lucky, or is this a regression? Unfortunate that this widget seems so difficult to get right, as quite a bit of (re)work seems to have gone into it already by the developers. |
@EthanLMartin you are correct, the documentation states exactly the opposite of the actual behavior. the truth is: if date_format or time_format are set, format is ignored. We have to change either the docs or the implementation. I am leaning towards changing the implementation. Does anybody have any other proposals on how to approach this? |
- don't display the current date by default or when the field is empty (#3679) - **potentially breaking change** - add `default: '{{now}}'` option to enable the current behavior of displaying the current time (using the specified format) - add UTC indicator when `picker_utc: true` - improve how `Z` in format and `picker_utc: true` work together - reorder format importance: if `format` is set, `date_format` and `time_format` (if strings) are ignored (#7250) BREAKING CHANGE: The datetime field is empty by default, from now on, but it was prefilled with the current date until now. Use `default: '{{now}}'` to prefill the field with the current date.
@EthanLMartin @adrian5 this was addressed in #7261 and released in 3.3.0. Can you test it and let me know if it works for you now? |
@martinjagodic I have just tested this on 3.3.2 and |
Describe the bug
When using the date time widget, if the date_format or time_format options are used, then the format option is ignored.
The documentation specifies that "If set, date_format and time_format are not used."
To Reproduce
format
,date_format
andtime_format
options (e.g.YYYY-MM-DDTHH:mm:ss
,DD/MM/YYYY
andHH:mm
respectively){date_format}T{time_format}
(e.g.DD/MM/YYYYTHH:mm
based on the above)Expected behavior
As per the documentation, expected the saved format so be the overall format specified. (In the examples above this would be
YYYY-MM-DDTHH:mm:ss
)Screenshots
N/A
Applicable Versions:
CMS configuration
Additional context
N/A
The text was updated successfully, but these errors were encountered: