Skip to content
Snippets Groups Projects
Unverified Commit 9675404b authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

fix implicit date parsing from numbers (#22158)

* check ci

* add test-case

* apply iso format only to numbers
parent 4d31c458
Branches
Tags
No related merge requests found
......@@ -93,6 +93,8 @@ export function parseTimestamp(value, unit = null, local = false) {
m = TEXT_UNIT_FORMATS[unit](value);
} else if (unit in NUMERIC_UNIT_FORMATS && typeof value == "number") {
m = NUMERIC_UNIT_FORMATS[unit](value);
} else if (typeof value === "number") {
m = moment.utc(value, moment.ISO_8601);
} else {
m = moment.utc(value);
}
......
......@@ -21,6 +21,7 @@ describe("time", () => {
["2015-01-01T00:00:00.000+00:00", 0, NY15_UTC],
["2015-01-01T00:00:00.000+0000", 0, NY15_UTC],
["2015-01-01T00:00:00Z", 0, NY15_UTC],
[2015, 0, NY15_UTC],
["2015-01-01T00:00:00.000+09:00", 540, NY15_TOKYO],
["2015-01-01T00:00:00.000+0900", 540, NY15_TOKYO],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment