I want to recognize a string value is date string or not in react. Because I want to change the format of date, if the value is a date string.
this is my code:
let value = //get a string value from other component (e.g. `2020-9-8 00:00:00` or `text`
value is date string // I don't know how to write this condition and check value is dateString
?
moment(value,"YYYY-M-D HH:mm:ss").format("jYYYY/jM/jD HH:mm:ss");
:
value;