Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: changing image Date added
The main reason we use intl is i18n, since strftime() is deprecated, and date() is English only. As long as only numeric values are present in a date format, we go with date(), which looks pre-Gregorian consistent. But for more localised formats, intl seems unavoidable.
It might be feasible to integrate a switch from Gregorian to Julian calendar for pre-1582 dates, but is it really worth doing? BC era wouldn’t fit into datetime db type anyway.
Offline
Re: changing image Date added
Let’s stick with what we have. If anyone is using pre-Gregorian dates, well, they’ll have to add the calendar attribute to their tags, right?
<txp:date type="image" calendar="julian" ... />
Edit: ugh that’s fine for front side but this is back-end isn’t it. Ignore me. It’s late.
Last edited by Bloke (Yesterday 23:50:26)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#27 Today 08:11:35
Re: changing image Date added
A brief test (PHP 8.4): In the images panel, all work as expected. There is a 9 hours difference between the Textpattern time (preference time zone set to UTC) and the MySQL DB time (set to OS time – JPN standard. UTC – 9).
One thing I noted, but perhaps that is not yet fully implemented: I post 3 images in an article (in a <txp:images id="1,2,3" "sort=date asc" /> container), including: Date: <time datetime="<txp:image_date format="iso8601" />"> <txp:image_date /> </time> below the image.
An image dated 2025-09-14 outputs the correct date & time, and so does an image dated 1978-11-09 (timestamp: 1978-11-09T14:22:01+0000, 09 November 1978, 14:22), but the image dated 1925-09-22 15:23:11 (DB time, UTC -9) outputs 01 January 1970, 00:32 (iso8601: 1970-01-01T00:32:05+0000).
Sorting works OK.
But the article date stamps (<txp:posted /> and <txp:modified />) seem wrong (an offset of 18hours behind the real time)?
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#28 Today 09:36:17
Re: changing image Date added
phiw13 wrote #341210:
… but the image dated 1925-09-22 15:23:11 (DB time, UTC -9) outputs
01 January 1970, 00:32(iso8601:1970-01-01T00:32:05+0000).
Thanks for testing, this issue should be fixed now.
But the article date stamps (
<txp:posted />and<txp:modified />) seem wrong (an offset of 18hours behind the real time)?
This one is amazing, as if the -9 hours offset were applied twice. There are 3 time zones in play:
- php server time zone
- db server time zone
- txp pref time zone
The dates should correspond to the latter, but things can get complicated if the php server does not support all time zones. What does this output for you:
<txp:php>dmp(date_default_timezone_get(), tz_offset());</txp:php>
Offline