Globalize.js not formating the date only in German culture

378 Views Asked by At

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?

2

There are 2 best solutions below

4
Barry On

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

0
Jukka K. Korpela On

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.