- Validate a Date
The Date object makes validating a date easy.
- Month and Day Names
The Date object is set up to make extracting a month or day of the week by name trivially easy, all you need is an array of the names.
- Daylight Saving Time
- Day of Year
The Date object gives you the day of the week or the day of the month in a single call, to get the day of the year as easily requires that we add an extra two lines of code.
- Julian Date
A simple extension to the day of the year, the Julian Date simply has the year concatenated after the day number.
- Julian Day
Despite the similar names this is has nothing to do with Julian Dates and simply counts the days from a prehistoric starting point.
- Days in Month
The days in the current month would be a simple array lookup if it were not for leap years. We can use the built in Date object to determine how many days in February without having to code the three rules ourselves.
- Week of Year
There are a number of different ways to determine what makes up the first week of a year and so here is a somewhat longer discussion of how to set up the various alternatives.
- Last Day of the Month
- Date Selector
Add a calendar to an input field to allow a date to be entered by clicking on the calendar.
- UTC to Local
Define a specific time and convert that to your visitor's local time.
To make your date processing even easier I have combined many of the above together into one library to extend all your Dates or if you prefer to leave the Date object alone and use a different object when you want the extended date functionality.