Skip to content

Update MomentLocalizer to accept MongoDB date format #11

@danigomez

Description

@danigomez

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
       }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions