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.
Online
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>
Online
#29 Today 11:14:43
Re: changing image Date added
etc wrote #341211:
Thanks for testing, this issue should be fixed now. That would e very valuable addition to Textpattern I think.
Yes! Now that looks nice across the board I think.
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>…
UTC
0
Quick test: As soon as I set the TXP pref to Tokyo instead of UTC then article dates are correct – both 4.9rc2 basic install and a 5.0-dev basic install (both have the very minimal configuration).
On two live servers, Singapore and Hong Kong based (UTC-8) the TXP (4.9) pref is set to “Tokyo” with no errors.
The local server php.ini has date.timezone = Asia/Tokyo.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#30 Today 11:31:55
Re: changing image Date added
phiw13 wrote #341213:
Quick test: As soon as I set the TXP pref to
Tokyoinstead of UTC then article dates are correct – both 4.9rc2 basic install and a 5.0-dev basic install (both have the very minimal configuration).
You mean the dates are correct in Tokyo time? Then, when the pref was set to UTC, they were correct (-9 hours) in UTC time, or the offset was double?
Online
#31 Today 11:38:25
Re: changing image Date added
etc wrote #341214:
You mean the dates are correct in Tokyo time? Then, when the pref was set to
UTC, they were correct (-9 hours) in UTC time, or the offset was double?
When the pref is set to UTC, the offset is indeed double. Date on my local computer: November 17, 17:10:xx (UTC -9), Date displayed on the Write tab, or on the public view of the article (<txp:posted />): November 16 23:10:xx.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline