Closed Jon78 closed 4 years ago
I see no need for such functionality, to be honest, however, you are most welcome to make a pull request.
It would require adding an additional button to the field like so https://flatpickr.js.org/examples/#flatpickr-external-elements
It’s more of a bug than an “enhancement” really. Say you have a nullable DateTime field, to set an optional publication date for example. If a user accidentally hits the date picker a date is automatic selected. In the current situation there is no way to unset the date, even if you select it and hit delete. So adding a clear button would be a workaround to this bug. The alternative would be to wait until this is fixed in Nova I guess.
So you're saying that a nullable field, can't be set to nullable? Hmm. Weird. I mean this plugin uses the underlying Nova DateFiled and simply extends it.
https://github.com/techouse/intl-date-time/blob/master/src/IntlDateTime.php#L9
You can set it to nullable on the backend side and you can store a null value. The issue is UI related however: you cannot unset a date once you pick it.
I see, so flatpickr is in the way preventing this from happening. Well nonetheless, try and make a PR if you can. I don't know when I'll have more time to work on this since I'm quite snowed under at the moment.
Fixed by @danielztolnai https://github.com/techouse/intl-date-time/pull/31
There is currently no way to clear a date once you set it. This is also a confirmed bug with the DateTime-field in Nova. One of the suggested solutions is to add a button to clear a date. A fix would come in handy (and gives people more reason to install this package over Nova's).