I have problems using the Date Formatter widget in my TV.
I’m using a couple of TVs for a concert listing. One of the TVs is for entering the event-date.
Now, although I used the Date Formatter widget with date format
’%Y-%m-%d %H:%i:%s’ (without the quotes of course) + input type "Date",
the output is not what I expected.
Instead of:
18-08-2007 21:00:00
I get this:
2007-08-18 21::
Both in the single documents, as well as in the Ditto-output.
Why?
The reason I’m reformatting it, is for Ditto to be able to sort the events in descending order:
[!Ditto? &tpl=`gigListing` &sortBy=`gigDatum` &sortDir=`DESC` &debug=`1`!]
Thing is... the sorting works fine, but the output misses minutes and seconds.
Anyone have a solution for this?
Or maybe it’s possible somehow to change the date-picker to use my date format (= mysql date format) from the get-go?
This would eliminate the need to use the date formatter altogether.
btw, I just checked the value in mySQL: It’s correct (i.e. modx_site_tmplvar_contentvalues / 18-08-2007 21:00:00)
No one? I can’t imagine that I’m the first one to encounter such a problem. This occurs on both v. 0.9.5 + 0.9.6, btw.
Is there a bugfix / hack / workaround for that?
-
MODX Staff
- 12,272 Posts
Never experienced it honestly. Try adding an &dateFormat=`` (or see the call to Ditto with your intended plugin. I don’t think Ditto supports passing through output widget results, just the raw values.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
It doesn’t only happen with the Ditto call. I’d have written a little snippet to emulate the Ditto call, if that were the only problem.
It happens in the actual document output as well. I’ve tried various formats only with day/month/year: they work as expected.
But as soon as I’m using time (e.g. %H:%i:%s) - alone or together with date elements, I either get gibberish (on my *nix installs) or plain nothing (behaviour on Win dev machine).
Does anyone know where the date formatter php functions/classes are? Maybe I can rewrite it and see how that goes...