Fix momentjs deprecation warning

This commit is contained in:
Grégoire Delattre 2020-04-15 12:46:43 +02:00
parent d94843be9f
commit 33a84f682d

View File

@ -3,22 +3,11 @@ import PropTypes from "prop-types";
import moment from "moment"; import moment from "moment";
const prettyDate = (input) => { const prettyDate = (input) => {
switch (typeof input) { if (typeof input !== "string" || input === "") {
case "string":
if (input === "") {
return "";
}
break;
case "number":
if (input === 0) {
return "";
}
return input;
default:
return input; return input;
} }
const date = moment(input); const date = moment(input, "YYYY-MM-DD HH:mm:ss Z");
if (!date.isValid()) { if (!date.isValid()) {
return ""; return "";
} }