getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Date field doesn’t allow empty time #4203

Closed psntr closed 2 years ago

psntr commented 2 years ago

Description

As the title describe it, using the property time doesn't allow an empty time. It fallbacks in the current time or adds 0:00

date:
    type: date
    display: DD.MM.YYYY
    time: true

Expected behavior
To be empty instead of falling back on the current time or 0:00

To reproduce

Add a date field with time property turned on

  1. Add a date field in the panel
  2. Turn on the time property
  3. Add a date and time and save
  4. Remove the time
  5. Save
  6. Time is added back automatically

Your setup

Kirby Version
Kirby 3.6.2

Additional context
This issue has been posted in the kirby forum here

distantnative commented 2 years ago

It's actually not a bug but intended. If you activate time on a date field, either the whole field is empty or it needs to have a time. Just an empty time input with a set date won't work. If you need that use case, you should rather look at having separate date and time fields.

psntr commented 2 years ago

Ok I understand, but don't you think it would be a good thing to allow empty field as well? It's quite common to have a case when you do an event page and time are sometimes set or not.

Will report your answer on the forum as well. Thank you!

distantnative commented 2 years ago

@psntr Honestly, not really. If you create a datetime field (basically what you do when activating time on a date field), it would be a very weird and invalid state to have it with the date part but no time. For your case of a required date but an optional time, two separate fields make a lot more sense.

psntr commented 2 years ago

In your point of view I understand. But then as a user I wonder why Kirby accepts this option in the first place while one could also add the time field instead of having it in the date. Thus removing any confusion about this field.

Because the UI in the panel highly suggest you could simply not add anything and it would be OK.

Could be useful to bring this topic back to the forum since two other people seem to wonder the same question.