fix: handle sec & ms timestamps properly

pull/702/head
Austin Brown 2 years ago
parent 39b9ff55c4
commit 712c01cec9

@ -51,9 +51,12 @@ export default function cleanDatePublished(
{ timezone, format } = {}
) {
// If string is in milliseconds or seconds, convert to int and return
if (MS_DATE_STRING.test(dateString) || SEC_DATE_STRING.test(dateString)) {
if (MS_DATE_STRING.test(dateString)) {
return new Date(parseInt(dateString, 10)).toISOString();
}
if (SEC_DATE_STRING.test(dateString)) {
return new Date(parseInt(dateString, 10) * 1000).toISOString();
}
let date = createDate(dateString, timezone, format);

Loading…
Cancel
Save