-
-
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
Datetime Widget Displays current Datetime when field is empty #3679
Labels
Comments
Undistraction
changed the title
Datetime Widget Displays current Date time when field is empty
Datetime Widget Displays current Datetime when field is empty
Apr 30, 2020
erezrokah
added
type: bug
code to address defects in shipped code
area: extensions/widgets
labels
Apr 30, 2020
Hi @Undistraction, can you share a config file? I'm using: backend:
name: test-repo
media_folder: assets/uploads
collections: # A list of collections the CMS should be able to edit
- name: 'posts' # Used in routes, ie.: /admin/collections/:slug/edit
label: 'Posts' # Used in the UI
label_singular: 'Post' # Used in the UI, ie: "New Post"
folder: '_posts'
create: true # Allow users to create new documents in this collection
fields: # The fields each document in this collection have
- { label: 'Title', name: 'title', widget: 'string', tagname: 'h1' }
- {
label: 'Publish Date',
name: 'date',
default: '',
widget: 'datetime',
dateFormat: 'YYYY-MM-DD',
timeFormat: 'HH:mm',
format: 'YYYY-MM-DD HH:mm',
} |
@erezrokah Sorry. Had to roll-back to using the date widget. I'll find some time in the next week and put together a repro. |
@erezrokah |
martinjagodic
added
area: extensions/widgets/datetime
and removed
area: extensions/widgets
labels
Aug 5, 2024
martinjagodic
added a commit
that referenced
this issue
Aug 12, 2024
- 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.
Done in #7261 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
I just tried to switch us over from the Date widget to the Datetime widget, however, it appears the Datetime widget will always display the current date/time, even if the field has no value.
This makes it look like the field has a value when it does not and is very confusing for users.
To Reproduce
''
or do not set a default value.Expected behavior
The widget should behave the same as the Date widget, showing a blank field until the field is clicked into.
Applicable Versions:
The text was updated successfully, but these errors were encountered: