Date object that provides some functionality to help, but it still is difficult. If you're going to be working with dates frequently in your app, it's probably best to reach for a 3rd party library to work with dates. Two popular options are Moment.js and date-fns.
const today = new Date(); const mar1_2020 = new Date('2020-03-01');
You can pass a string in that represents a particular day. The format can be seen above,
You can also get a reference to a current point in time by calling the
Date.now() method. This method returns the number of milliseconds that have elapsed since Jan 1, 1970. Many applications will save this number in a database to timestamp when something occurred. You can pass that number into the
Date constructor as well to create a date reference at a particular moment.