SumankumarG
SumankumarG

Reputation: 1

Globalize.js not formating the date only in German culture

I have used Globalize.js to localize and format the date. it all works fine in different culture, but not working properly in German culture (de-DE). Code i have used to format.

Globalize.format(new Date(), "MM/yy/dd","de-DE");

it returns "10.14.01". i expecting the value as "10/14/01".

what might be the problem. is that issue in globalize? please anyone help me to come out of this headbang.

finally i found the cause of the problem. In globalize.culture.de-DE culture file

calendars: { standard: { "/": ".", firstDay: 1, .... .....

            }

some standard has been handled like above. could any help me about why this code block has been used?

Upvotes: 0

Views: 393

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201508

It seems that you are using the old version of Globalize.js, which works rather well but isn’t developed any more, and it can be difficult to find documentation of it except in my book.

The rules for the format argument are somewhat obscure, but when a format like "MM/yy/dd" does not work, put any characters that should appear “as is” inside Ascii apostrophes, in this case

"MM'/'yy'/'dd"

Some punctuation characters can be used inside the format string without such quoting, but when in doubt, quote.

Upvotes: 0

Barry
Barry

Reputation: 3723

The culture de-De is German, use nl-NL instead.

Upvotes: 1

Related Questions