mastodon.uno è uno dei tanti server Mastodon indipendenti che puoi usare per partecipare al fediverso.
Mastodon.Uno è la principale comunità mastodon italiana. Con 75.000 iscritti è il più grande nodo Mastodon italiano: anima ambientalista a supporto della privacy e del mondo Open Source.

Statistiche del server:

6,7K
utenti attivi

funny quirks. We just stumbled upon a problem in production where we were sharding datas using Year and Week syntax.

The code was something like $Suffix = $now->format("YW"). Well, turns out 2024-12-31 returns 202401 as Suffix because Year is 2024 and week would be 53.

Long story short, format has a macro macro "o" that returns ISO8601 year, so $now->format('oW') returns 202501 correctly for last days of the year.

That's one of those corner case you'd never take in consideration.

@Skeybu I would! (But then again, I wrote this code ;-) ).

@derickr Well, I'd expected it to go to 202453 as that would have ben more coherent, but I guess than on 2025-01-01 we would have 202553 that would have been even worse.

Maybe it should be highlighted a bit more in the manual.

@Skeybu Where exactly? I think the descriptions at php.net/manual/en/datetime.for are fairly clear?

'W' mentions the ISO 8601 week number, and 'o' (showing up above 'Y') mentions in detail "ISO 8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead."

If you have a suggestion how to change this, I'm happy to hear.

www.php.netPHP: DateTimeInterface::format - ManualPHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.
Andrea Brancatelli

@derickr You're right the description is right absolutely on point, but sometimes in the manual there are those "Note" blocks for common mistakes.

I was thinking about one of those.

As as I said, it's not because it's not clear it's just because it's something that may easily slip off.