Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7e57e2a

Browse files
author
Daniel Gómez
committed
#11 Update momentLocalizer
1 parent c69ba43 commit 7e57e2a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-autoform-utils",
3-
"version": "1.0.5-experimental",
3+
"version": "1.0.6-experimental",
44
"description": "Common javascript files to all the redux-autoform related projects",
55
"main": "./lib/index.js",
66
"scripts": {

‎src/localization/momentLocalizer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ export default function(moment) {
4646

4747
parse(value, format, culture) {
4848
if (!value) return undefined; // localizers should return undefined for empty inputs
49-
const m = getMoment(culture, value, format);
50-
if (m.isValid()) return m.toDate();
49+
let m = getMoment(culture, value, format);
50+
51+
if(m.isValid()) return m.toDate();
52+
else { //is ISO-8601?
53+
m = getMoment(culture, value, moment.ISO_8601);
54+
if(m.isValid()) return m.format(format);
55+
}
5156
return null; // localizers should return nul for invalid inputs
5257
},
5358

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /