Day.js library - How to solve invalid date bug in Safari when using dayjs

Profile Picture
- Published on Aug 20, 2019🌏 Public

We are using Day.js to show formatted dates in GitDuck, but we recently discovered that Safari (Mac and iPhone) was not parsing it correctly. It was showing "Invalid date".

The fix was simple, all we need to do was use the format dayjs(date).format('YYYY-MM-DD')

You can check more about Day.js at https://www.npmjs.com/package/dayjs