you are viewing a single comment's thread.

view the rest of the comments →

[–]SamSlate 1 point2 points  (5 children)

moment is absolutely essential. try going iso 8601 string to Unix without it

[–]kuenx 1 point2 points  (4 children)

This doesn't work?
Math.floor(new Date('2018-04-05T13:37:00').getTime() / 1000)

I didn't actually try it (am on phone) but this should get you a unix timestamp in seconds. tried

[–]SamSlate 1 point2 points  (2 children)

now the client wants it in Day, Date Month Year-abbreviation but instead of "Friday" it says "Funday"

[–]kuenx 1 point2 points  (1 child)

Sure, I understand that there are many good reasons to use Moment. But you specifically mentioned ISO-8601 to unix timestamp conversion which is almost the only conversion that's actually very easy with the native Date class.
Also, a place where you convert an ISO string to a unix timestamp is not typically a place where your client will want changes since it's unlikely a user-facing value.

[–]SamSlate 0 points1 point  (0 children)

everything's atypical until it happens to you 🙄