Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
A few changes to DatetimeType to address #3160
Major Changes
format
option removed. In its placedateFormat
,timeFormat
andtzFormat
created. This allows the formats used in DatetimeType to be shared with DatetimeField. Now the display format specified in the three new options is used for validation and the admin UI fields.parseFormat
option behaviour changed.Previously, a format specified in
parseFormat
would be the only acceptable format for validation purposes. With an incorrectly specifiedparseFormat
option, you could end up in a situation where a date chosen from the datepicker wouldn't validate.Now, any format specified in
parseFormat
is added to the list of acceptable formats. This list already includes the default list and the format specified indateFormat
,timeFormat
andtzFormat
.parseFormat
now only needs to be set if you want to accept additional formats not already in the list - in many cases it can be omitted, even with a custom display format.Other changes
The format specified in
dateFormat
,timeFormat
andtzFormat
is used to format the admin UI fields.The placeholder in the time field in the admin UI now reflects
timeFormat
.Documentation updated
Related issues (if any)
Testing
npm run test-all
ran successfully.No new failures introduced. 7 pre-existing failures in unrelated areas remain.