fix new Date() returns invalid date on safari, thus causing the contribution not able to display

This commit is contained in:
liz2020
2020-11-19 04:38:26 -05:00
parent b9bf4c405a
commit 6529b747e8

View File

@@ -11,7 +11,7 @@ let contributions;
contributions = JSON.parse(dom.getAttribute('data')); contributions = JSON.parse(dom.getAttribute('data'));
let year = 0; let year = 0;
for (const item of contributions) { for (const item of contributions) {
item.publishDate = decodeURI(item.publishDate); item.publishDate = decodeURI(item.publishDate).replace(' ','T');
item.date = new Date(item.publishDate); item.date = new Date(item.publishDate);
if (item.date.getFullYear() > year) { if (item.date.getFullYear() > year) {
year = item.date.getFullYear(); year = item.date.getFullYear();