Update pub_date bug in pt-pt/pt-br
icaromh opened this issue ยท 5 comments
Issue Summary
When you update a post with another language like Portuguese, the pub_date doesn't update because of strtotime()
at Postleaf.php:239;
When is passed somthing like 28 ago 2016
the strtotime return bool:false
and Postleaf.php:240 set the time() to pub_date;
Steps to Reproduce
- Change the language pack to Portuguese
- Change a pub_date of some post
- Save
Hmm, the problem is that strtotime()
only parses English names. The date control might need to be replaced with a localized date picker.
Looks easier than parse date in PHP before use strtotime()
. Are you working on that?
Do you have some plugin in mind?
Ok, some history. ๐
Early on, I figured I'd do like every other app and just throw in a datepicker library, but most of them were too heavy, not mobile friendly, or required more dependencies to work. Top contenders were:
- Pikaday: beautiful, light, but requires moment.js for formatting. This is getting heavy for two date/time inputs.
- Bootstrap Date/Time Picker: fairly easy to use, but does a lot. Currently supports Bootstrap 3, not 4, so we'd be maintaining customizations.
- pickadate: great for mobile, but enormous on desktops.
At the end of the day, all we really need is to get the date/time into a standard ISO format:
YYYY-MM-DD HH:MM:SS
So I ditched the datepicker concept and used two textfields instead. This worked fine, but then I got clever and changed the format to 30 Aug 2016
without thinking that it would affect the way strtotime()
parsed it. Whoops.
I've reverted this change so the date/time controls default to an ISO format once again, and I've updated the controls to date/time inputs. For supportive browsers, you'll get a nice, localized date picker. For all others, you'll get standard text inputs with internationally recognized date/time formats.
I think this is a forward-thinking solution that's easy to use with or without browser support for date/time inputs, and it's convenient because it doesn't require a heavy library.
So let's try this first and see how it works. ๐
This works really well on iOS too. I love their built-in date/time pickers, and letting the browser handling localization is a nice plus.