Date doesn't allow empty time?

Don’t know if I made a mistake in my blueprint, but it seems like I cannot have an empty time if the time field is enable.

dateend:
    label: Date end
    type: date
    width: 1/2
    display: DD.MM.YYYY
    time: true
    translate: false

It’s for an event page, where sometime time are specified sometimes is not. Therefore this field should be empty if no time is specified, but in this case, it returns the current time.

3 Likes

Still not solved but in the meantime I remove the time option time: false and manually add another field:

timeend:
     type: time

It’s sadly not so efficient since Kirby seems to have the ability to have time in the date field.

Should this be add in the github as a bug or a feature?

Yes, please report on GitHub, thank you!

Thanks for your reply. Issue added here:


Edit: answer from GitHub by distantnative

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.

I don’t agree on that but that’s the way it is at the moment, hopefully we can see this field evolve into something more flexible. :v:

1 Like

Hello, i am actually having the same problem with Kirby 4.2.0 (PHP 8.2). I have two date fields one for startDate and one for endDate without Time argument.

startDate: 
  label: Date
  type: date
  required: true
endDate: 
  label: End date
  type: date

If i don’t ever put anything in the field or if I fill it once and for all it works fine. But once a field have been filled I cannot unfill it. It puts automatically the current date. Also when I erase the field content, then the calendar doesn’t work anymore.

Capture 2024-05-23 à 10.49.34

In that new empty state, I cannot save the page, it looks like nothing have changed, but the field stays apparently empty (but actually filled with current date)

User should be able to set empty date field.

My config is :

'timezone' => 'Europe/Paris',
  'locale' => [
    'LC_ALL'      => 'fr_FR.UTF-8',
    'LC_COLLATE'  => 'fr_FR.UTF-8',
    'LC_MONETARY' => 'fr_FR.UTF-8',
    'LC_NUMERIC'  => 'fr_FR.UTF-8',
    'LC_TIME'     => 'fr_FR.UTF-8',
    'LC_MESSAGES' => 'fr_FR.UTF-8',
    'LC_CTYPE'    => 'fr_FR.UTF-8',
  ],

  'date'  => [
    'handler' => 'intl'
  ],

What could it be ? Thank you.

I think by design this field is quite user unfriendly, and as you can see in the response from the Git repo, the developer in charge of this field believe it’s how it’s supposed to be, unless you other users aren’t vocal about it, it won’t change and you will have to create and extra field with just with TIME. At the end that’s what I did, having field for date and another juste for the time… which is indeed a bit tedious.