|
jquery.datemaker.js - jQuery plugin to create Date objects Introductionjquery.datamaker.js provides an easy way to create Javascript Date objects using simple time interval indicators. Use datamaker to create Data objects to use with jQuery cookie plugin. Time interval indicators are like those in Perl CGI::Cookie: '+1M,' '-10d,' etc., and Rails ActiveSupport-like time indicators: '3.days.ago.' A few named time indicators: 'midnight' and 'now.' Note that '3.days.ago' is a string, not a method on an integer. Integrates with jQuery cookie plugin $.cookie('cookie_name', 'cookie_value', { expires: $.datemaker('+1h') }); DetailsCreate a Date object using the given date format string. Date formats (most like Perl CGI::Cookie) Date formats like Rails ActiveSupport::CoreExtension::Numeric::Time - s (String): number of seconds
- m (String): number of minutes
- h (String): number of hours
- d (String): number of days
- M (String): number of months
- y (String): number of years
- x.second.ago (String)
- x.second.from_now (String)
- x.seconds.ago (String)
- x.seconds.from_now (String)
- x.minute.ago (String)
- x.minute.from_now (String)
- x.minutes.ago (String)
- x.minutes.from_now (String)
- x.hour.ago (String)
- x.hour.from_now (String)
- x.hours.ago (String)
- x.hours.from_now (String)
- x.day.ago (String)
- x.day.from_now (String)
- x.days.ago (String)
- x.days.from_now (String)
- x.month.ago (String)
- x.month.from_now (String)
- x.months.ago (String)
- x.months.from_now (String)
- x.year.ago (String)
- x.year.from_now (String)
- x.years.ago (String)
- x.years.from_now (String)
- midnight (String):
- now (String):
Example$.datemaker('+30s'); // 30 seconds from now
$.datemaker('+5m'); // 5 minutes from now
$.datemaker('+1h'); // 1 hour from now
$.datemaker('-1d'); // 1 day ago
$.datemaker('+10d'); // 10 days from now
$.datemaker('+2M'); // 2 months from now
$.datemaker('-6M'); // 6 months ago
$.datemaker('+1y'); // 1 year from now
$.datemaker('30.seconds.ago'); // 30 seconds ago
$.datemaker('30.seconds.from_now'); // 30 seconds from now
$.datemaker('5.minutes.ago'); // 5 minutes ago
$.datemaker('5.minutes.from_now'); // 5 minutes from now
$.datemaker('1.hour.ago'); // 1 hour ago
$.datemaker('1.hour.from_now'); // 1 hour from now
$.datemaker('10.days.ago'); // 10 days ago
$.datemaker('10.days.from_now'); // 10 days from now
$.datemaker('6.months.ago'); // 6 months ago
$.datemaker('6.months.from_now'); // 6 months from now
$.datemaker('1.year.ago'); // 1 year ago
$.datemaker('1.year.from_now'); // 1 year from now
$.datemaker('midnight'); // midnight
$.datemaker('now'); // nowExampleUsing with jQuery cookie plugin $.cookie('cookie_name', 'cookie_value', { expires: $.datemaker('+1h') });
|
Wed Nov 19 2008 00:00:00 GMT-0500 (Eastern Standard Time)