Created
August 23, 2009 22:05
-
-
Save sudara/173480 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SC.RecordAttribute.registerTransform(SC.DateTime, { | |
| /** Transforms a date to an integer of milliseconds since 1970 */ | |
| /** @private - convert an int to a date */ | |
| to: function(n, attr) { | |
| /* Transform a date coming from rails in the format 2008/12/31 10:45:23 +0200 */ | |
| return SC.DateTime.parse(n,'%Y/%m/%d %H:%M:%S'); | |
| }, | |
| /** @private - convert a date to an int */ | |
| from: function(date) { | |
| return date.get('milliseconds'); | |
| } | |
| }); | |
| SC.Query.registerComparison('created_at', function(d1,d2){ | |
| /** Use SC.DateTime.compare() for date properties */ | |
| return SC.DateTime.compare(d1,d2); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment