Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Slice and dice Javascript dates like a superhero!
JavaScript
Branch: master

README.md

Superdate!

Slice and dice Javascript dates like a superhero!


Right now:

Superdate(); // returns an 'enhanced' Date object

Start of the week:

Superdate().start('week'); // Monday, midnight

Wednesday next week:

Superdate().start('week').add('week').add('day', 2); // Wednesday, midnight

Do two dates fall on the same day?

Superdate(date1).same('day', date2); // true/false

... in the same month?

Superdate(date1).same('month', date2); // true/false

Is my assignment due in the week before my birthday?

Superdate(assignmentDueDate).add('week').same('week', myBirthday);

Same time, but on April Fool's:

Superdate().set({ month: 3, day: 1});

Display-friendly day of week:

Superdate().getDayOfWeekString(); // 'Friday'
Superdate().getDayOfWeekString(true); // 'Fri'

Display-friendly month:

Superdate().getMonthString(); // 'July'
Superdate().getMonthString(true); // 'Jul'
Something went wrong with that request. Please try again.