Surprising results from predefined CLDR formats
[email protected] (BPJ) Tue, 23 Feb 2021 17:53:51 +0100
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <CADAJKhC6=xKj_GjMYQUxUau2ZDc2foczU8ddK1UQmASKXXKiZg@mail.gmail.com> |
--000000000000d9dd6f05bc03c3f4
Content-Type: text/plain; charset="UTF-8"
Please consider this code:
``````perl
use DateTime;
my $dt = DateTime->now( locale => 'sv' );
for my $fmt ( $dt->locale->available_formats ) {
my $val = $dt->format_cldr($fmt);
say "$fmt : $val";
}
``````
Most of the formatted strings seem to be missing some whitespace and have
things in a surprisising order.
E.g. `MMMd` gives `feb.23` where I would have expected `23 feb.`.
I don't know if/what I'm doing wrong, or whether this is a DateTime,
DateTime::Locale or CLDR bug or indeed if it is a bug at all.
--
Better --help|less than helpless
--000000000000d9dd6f05bc03c3f4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto"><div dir=3D"auto">Please consider this code:</div><div di=
r=3D"auto"><br></div><div dir=3D"auto">``````perl</div><div dir=3D"auto">us=
e DateTime;</div><div dir=3D"auto"><br></div><div dir=3D"auto">my $dt =3D D=
ateTime->now( locale =3D> 'sv' );</div><div dir=3D"auto"><br>=
</div><div dir=3D"auto">for my $fmt ( $dt->locale->available_formats =
) {</div><div dir=3D"auto">=C2=A0 my $val =3D $dt->format_cldr($fmt);</d=
iv><div dir=3D"auto">=C2=A0 say "$fmt : $val";</div><div dir=3D"a=
uto">}</div><div dir=3D"auto">``````</div><div dir=3D"auto"><br></div><div =
dir=3D"auto">Most of the formatted strings seem to be missing some whitespa=
ce and have</div><div dir=3D"auto">things in a surprisising order.</div><di=
v dir=3D"auto">E.g. `MMMd` gives `feb.23` where I would have expected `23 f=
eb.`.</div><div dir=3D"auto"><br></div><div dir=3D"auto">I don't know i=
f/what I'm doing wrong, or whether this is a DateTime,</div><div dir=3D=
"auto">DateTime::Locale or CLDR bug or indeed if it is a bug at all.</div><=
div dir=3D"auto"><br></div><br><div data-smartmail=3D"gmail_signature">-- <=
br>Better --help|less than helpless</div></div>
--000000000000d9dd6f05bc03c3f4--