Quantcast
Channel: Tudor Barbu's blog
Viewing all articles
Browse latest Browse all 28

Working with dates in Javascript

$
0
0

I have found a cool Javascript library for manipulating dates called datejs. It’s really simple to use and offers a lot of syntactic sugar (examples taken from their website)

// Add 3 days to Today
Date.today().add(3).days();

// Is today Friday?
Date.today().is().friday();

// Number fun
(3).days().ago();

// 6 months from now
var n = 6;
n.months().fromNow();

It saves a lot of headaches ;)


Viewing all articles
Browse latest Browse all 28

Trending Articles