Showing 179 scripts

Sort by name or size

Rails' time extensions

Rails' time extensions

I’ve ported Rails’ Numeric Time extensions to JavaScript since I needed to do some date calculations for a project I’m working on. Now one should be able to calculate dates in JS like this:
(5).seconds() // => 5000
(2).weeks() + (2).hours() + (15).seconds() // => 1216815000
(1).week().fromNow().toDate() // => Fri Sep 22 2006 19:16:32 GMT+0200 (CEST)
var date = new Date(2000, 11, 18, 18, 15, 23);
(2).years().since(date).toDate() // => Thu Dec 19 2002 06:15:23 GMT+0100 (CET)
Website:
Rails' time extensions
Author:
Martin Ström
Size:
0.5 KB
Last modified:
11/06/2007
License:
n/a
Tags:
date & time
Rating:
4
(4/5 from 2 votes)
Your rating:
Please sign in or register to rate this script
Select multiple tags with Ctrl+click (Cmd+click on Mac)

Found a bug or have a suggestion?Let us know

bitsonnet corp · © 2007-2014 · all rights reserved

Sign In / Register / Forgot password