Formatting dates with quarters
Closed this issue · 2 comments
From @DaTrader Not my intention to use this github issue as a thread, but while at it, I also took a look at your other libraries, namely Date/Time and Territories. I saw the support for quarters in Date/Time as in 2Q. But does the date/time formatting also support formatting like 2Q21 21Q2 Y1Q2 1Q2Y? I have all these implemented in a proprietary manner at the app level (not as a library) but I believe they would be very useful in financial reporting for other users as well so I figured you may consider adding them in a future release as, unlike mine, your approach to the subject is standard based, and I for first would be more than happy to switch over to your other libraries.
The readme has the formatting codes. Here are some examples:
iex> Cldr.Date.to_string Date.utc_today, format: "yyqqq"
{:ok, "21Q3"}
iex> Cldr.Date.to_string Date.utc_today, format: "qqq-yy"
{:ok, "Q3-21"}
iex> Cldr.Date.to_string Date.utc_today, format: "qqq'Y'yy"
{:ok, "Q3Y21"}
I don't know your problem domain, but you did mention financial reporting. The library ex_cldr_calendars implements configurable financial calendars you might find useful. They work with date time formatting correctly as well.
Thanks. Must have missed this part in the docs. This will do just fine.