Skip to content

Commit 635fcf6

Browse files
authored
fix: handle sec & ms timestamps properly (#702)
1 parent ab40182 commit 635fcf6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cleaners/date-published.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ export default function cleanDatePublished(
5151
{ timezone, format } = {}
5252
) {
5353
// If string is in milliseconds or seconds, convert to int and return
54-
if (MS_DATE_STRING.test(dateString) || SEC_DATE_STRING.test(dateString)) {
54+
if (MS_DATE_STRING.test(dateString)) {
5555
return new Date(parseInt(dateString, 10)).toISOString();
5656
}
57+
if (SEC_DATE_STRING.test(dateString)) {
58+
return new Date(parseInt(dateString, 10) * 1000).toISOString();
59+
}
5760

5861
let date = createDate(dateString, timezone, format);
5962

0 commit comments

Comments
 (0)