Skip to content

Commit

Permalink
Merge pull request jquense#323 from evax/moment-localizer-parse-fix
Browse files Browse the repository at this point in the history
Handle invalid dates in the moment localizer
  • Loading branch information
jquense committed Feb 15, 2016
2 parents c664145 + c6bbb03 commit bd11101
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/localizers/moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export default function(moment) {
},

parse(value, format, culture) {
return value ? getMoment(culture, value, format).toDate() : null
if (!value) return null;
const m = getMoment(culture, value, format);
if (m.isValid()) return m.toDate();
return null;
},

format(value, format, culture) {
Expand Down

0 comments on commit bd11101

Please sign in to comment.