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

Parsing using iMMM returns incorrect date (off by one month) #60

Open
smartphonedesign opened this issue Jan 5, 2021 · 0 comments
Open

Comments

@smartphonedesign
Copy link

When parsing the month from iMMM format it uses a one-based index. So, Shw is month 10, but then it converts it to the Gregorian equivalent using zero-based index and so it is off by one month.

    const input = '22 Shw 1440';
    const output = moment(input, 'iDD iMMM iYYYY').format('iDD iMMM iYYYY');
    if (input !== output) {
        console.log(`${input} returned ${output}`);
    }

output is "22 Shw 1440 returned 22 Dhu-Q 1440"

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