silverstripe-blog
silverstripe-blog copied to clipboard
PublishDate cannot be set until post has been saved
SilverStripe 4.3.0 Blog 3.2.3
I've come across some very annoying behaviour around the PublishDate when adding new Blog Posts.
- Click 'Add new blog post'
- Add a title, some content, an image
- Click the 'Post Options' tag
- Manually set a publish date on the datepicker field
- Click 'Publish'
At this point the Publish Date field resets itself to the current date / time.
The same issue occurs in both Chrome and Opera (where the native datepicker works).
If you manually enter a date in Firefox, but do not enter a time, it works properly and sets the time to midnight.
Looking at the request, it seems the browsers which don't have a native datepicker are sending an empty value for the field if the time is not explicitly set.
I know that the removal of a datepicker has been discussed in a number of tickets in various places, but from a UI perspective, this is a bit of a regression since we're once again at the mercy of poor datepicker implementation in the browser.
I understand there is reluctance to re-introduce a datepicker library, but would separating the value into a date and time field be an acceptable solution to improve the UX? The underlying field could stay the same, but with a bit of logic to make the interface work.
One of my clients also complained about this. I would suggest maximizing UX (native when available, a js solution otherwise?) and then adding a preprocessor on the back-end to interpret the posted value as well as possible (i.e. support multiple formats).
I guess this is a general issue for DateTime fields though, not just for the Blog's PublishDate.