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

Update MomentLocalizer to accept MongoDB date format #11

Open
danigomez opened this issue Apr 24, 2017 · 0 comments
Open

Update MomentLocalizer to accept MongoDB date format #11

danigomez opened this issue Apr 24, 2017 · 0 comments
Assignees

Comments

@danigomez
Copy link

The MongoDB date format(ISO_8601) is not handled as a valid date in momentLocalizer

Proposed solution:

function parse(value, format, culture) {
           if (!value) return undefined; // localizers should return undefined for empty inputs
           var m = getMoment(culture, value, format);
           if(m.isValid()){
               return m.toDate();
           }else{ //is ISO-8601?
               m = getMoment(culture, value, moment.ISO_8601);
               if(m.isValid) return m.format(format);
           }
           return null; // localizers should return nul for invalid inputs
       }
@danigomez danigomez self-assigned this Apr 24, 2017
danigomez pushed a commit that referenced this issue May 10, 2017
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