Just spotted this via Ajaxian:

http://www.datejs.com/

It's got jQuery-like syntax for working with dates:

// What date is next thrusday?
Date.today().next().thursday();
 
// Add 3 days to Today
Date.today().add(3).days();
 
// Is today Friday?
Date.today().is().friday();
 
// Set to 8:30 AM on the 15th day of the month
Date.today().set({ day: 15, hour: 8, mintue: 30 });

Unfortunately it splooges methods and properties all over the Date and 
Number prototypes and objects, but this got me thinking...

Would it be possible to implement things like this with jQuery? 
Currently plugins add their methods to $.fn, however what if we could 
add other "plugin namespaces" such as $.date where methods could be 
added and then have some way of telling jQuery which plugin namespace to 
use?

You could possibly have:

$.date("tomorrow").is().friday(); // is tomorrow friday?

Guy

Reply via email to