Introduction to date-fns – a Lightweight JavaScript Date Library

0
0
views

Working with dates in JavaScript is a pain. Native date methods are often verbose and occasionally inconsistent — something which also makes them error-prone. But good news is at hand. There are several libraries that exist to take the pain out of date manipulation. These libraries are to JavaScript dates, what jQuery is to the native DOM API. Let me give you an example. This is the accepted answer to a Stack Overflow question asking how to get last day of the month: var t = new Date(); alert( new Date(t.getFullYear(), t.getMonth() + 1, 0, 23, 59, 59) ); Of…
Introduction to date-fns – a Lightweight JavaScript Date Library