Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Year is set to 2001 by default in German #265

Open
maba4891 opened this issue Apr 6, 2017 · 0 comments
Open

Year is set to 2001 by default in German #265

maba4891 opened this issue Apr 6, 2017 · 0 comments

Comments

@maba4891
Copy link

maba4891 commented Apr 6, 2017

I am using datejs in a node.js application. I have set it to the German localization.
If somebody enters a date without a year, e.g. "12. März" the year is weirdly set to 2001 by default if I parse it:

require('datejs');
try { Date.i18n.setLanguage("de-DE"); } catch(e) {console.log(e);}

console.log(Date.parse("12. März"));
// Output: Mon Mar 12 2001 00:00:00 GMT+0100 (CET)

According to the documentaion the default year that is assumed should be the current year, i.e. 2017 not 2001. This works if I disable the German localization:

require('datejs');

console.log(Date.parse("12 March"));
// Output: Sun Mar 12 2017 00:00:00 GMT+0100 (CET)

So this seems to be a bug affecting the German localization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant