Custom date units for javascript
I'm working on a javascript app that does a lot of Date arithmetic, and for convenience (and readable code), I've found it useful to create some constants that I load into each page:
var oneSecond = 1000;
var oneMinute = 60*oneSecond;
var oneHour = 60*oneMinute;
var oneDay = 24*oneHour;
var oneWeek = 7*oneDay;
I'm going through a code refactor (down with cruft!), and it occurs to me that I can't be the first one who needed constants like these.
Is there an canonical javascript library th开发者_JAVA百科at provides these (or something comparable) so I can just use it and be nicer to my readers?
I think you're looking for datejs:
http://www.datejs.com/
精彩评论