Fix momentjs deprecation warning
This commit is contained in:
parent
d94843be9f
commit
33a84f682d
@ -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 "";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user