0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Removed preceding 0 in date string

no issue

- Removes preceding 0 in `date` section of a date string
For ex. - 05 June -> 5 June
This commit is contained in:
Rish 2020-09-16 23:35:13 +05:30
parent fa7258b247
commit 1baa21ddab

View file

@ -1,7 +1,7 @@
export const getDateString = (isoDate) => {
const date = new Date(isoDate);
const month = date.toDateString().substring(4, 7);
const day = date.toDateString().substring(8, 10);
const day = date.toDateString().substring(8, 10).replace(/^0+/g, '');
const year = date.toDateString().substring(11, 15);
return `${day} ${month} ${year}`;
};