JavaScript makes the manipulation of dates and times extremely simple through its provision of the date object. By loading all of the dates and times that you need to process into a date object you can easily perform any calculations that are needed without needing to worry about any of the conversions between any of the different time units (such as how many seconds there are in a day). For example consider the various ways you can determine the last day of a month in JavaScript, the more you make use of the date object in the calculation the simpler the code becomes.
While the built in date object itself provides a reasonable amount of functionality for the manipulation of dates and times, it is when you add extra methods of your own to your date objects that you really enhance the power of JavaScripts date and time handling.
JavaScript defines a number of different ways of loading a date into a date object. If you define a new date object without giving it a value yourself then it will be automatically assigned the current date and time. If you pass a text string to it then JavaScript will attempt to convert that to a date and time using the locality rules from the local computer where the browser is running so that it can take into account which order the person entering a date on that computer would expect to enter the month and day. A third way allows you to pass in a series of numbers representing the individual components of the date and time in decending order of size (so starting with the year and ending with milliseconds). Yet another way of creating a date object is to copy another date object.
Once you have loaded your date and time into a date object you can easily manipulate the date in so far as adding or subtracting an amount of time to it or finding the difference between two dates as the date object uses an internal format that makes such comparisons trivial. You can even add methods to make certain manipulations easier such as adding days to a date and calculating Age Last Birthday or determining the number of days or business days between two dates.
One area in which the date object as supplied by JavaScript doesn't provide quite as simple to use functionality as many people would like is in terms of being able to extract the date and time from the date object in the desired format. This is one area where adding your own code to the JavaScript date object really comes into its own since once you add a method that will allow dates and times to be extracted in a specific format you can reuse that method whenever you want any date in that format. For example you might want to add methods to allow easy extraction of Julian Day, Day of Year, Week of Year, Julian Date and Month and Day names. The ultimate in this regard is to have a method that allows you to specify the format and have the date returned in whatever format you specify.
One potential issue with using JavaScript dates is that JavaScript assumes that the week starts on a Sunday. There are however places in the world where the week is considered to start on a Saturday or a Monday. We can easily add methods to take care of starting the week on a different day.
Using the built in JavaScript date object for all of our date and time manipulations makes for much simpler coding where any calculations involving dayes and/or times are concerned for example we can easily determine the number of Tuesdays in this month or the number of times that any other day of the week occurs in any month with just a couple of lines of JavaScript using a date object.

