What's the difference of luxon's yyyy and y?

Here’s the docs: https://moment.github.io/luxon/docs/manual/formatting.html

It says that y is “year, unpadded” and yyyy is “four- to six- digit year, pads to 4”, but they have the same output.

Hi @Chronzam, they only have the same output for a year that has 4 digits already – try entering the date of Charlemagne being crowned Holy Roman Emperor, for instance.

3 Likes

As m3g4 is pointing out - padding only pads if the value is smaller than the minimum size. You can see this clearly in their examples as well - look at the difference between M and MM, where they use August (Month 8) as their example date.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.