Before we could decide on this, I think we would need to make clear
our policy on modifications to primordial objects like Date in
implementations. I proposed to the Narwhal folks that we would keep a
policy of only modifying primordial objects during the bootstrapping
process (never in modules loaded by the program), and that we would
only do so in order to upgrade the material we had to either an ES5 or
a ServerJS standard. We would never augment globals in such a way
that they could introduce an incompatibility with a future standard.
Kris Kowal
Before we could decide on this, I think we would need to make clear
our policy on modifications to primordial objects like Date in
implementations. I proposed to the Narwhal folks that we would keep a
policy of only modifying primordial objects during the bootstrapping
process (never in modules loaded by the program), and that we would
only do so in order to upgrade the material we had to either an ES5 or
a ServerJS standard. We would never augment globals in such a way
that they could introduce an incompatibility with a future standard.
No disagreement about modifying primordials.
I do think that there should be something like a DateUtil module. JS's standard date handling is just too primitive for real work. Creating a date handling library is something that every implementer has to do.
A ServerJS standard that can co-exist with a host implementation would seem ideal. [snip] If one of the goals of ServerJS is to create a common base for implementing server-side JavaScript, then date manipulation should be part of it.
On Wed, Jul 29, 2009 at 10:00 AM, Mark Porter <dm4...@gmail.com> wrote:No disagreement about modifying primordials.
And none here. I wasn't concerned with where to hang the code, but whether serverjs wants to do this at all.
I do think that there should be something like a DateUtil module. JS's standard date handling is just too primitive for real work. Creating a date handling library is something that every implementer has to do.
Every implementer does not need to do this. One can choose from many open source date formatting implementations. We've already seen two on this thread, and more are listed in the wiki. ECMAScript made a deliberate choice not to enhance the lacking host date formatting in core and felt the problem was beyond the scope of the language. It's being solved in JavaScript by toolkits in levels of detail. Getting the i18n tables right is non trivial, and some date libraries go through great lengths to provide this sort of support. Similarly, time zones are complex, but some folks are tackling that problem using the Olson database (e.g. fleegix)
A ServerJS standard that can co-exist with a host implementation would seem ideal. [snip] If one of the goals of ServerJS is to create a common base for implementing server-side JavaScript, then date manipulation should be part of it.
What are the boundaries of what serverjs needs to standardize? Why does serverjs need to get in the toolkit business or rubber stamp one date formatting API as standard? Why not provide only what needs to be available to bootstrap a common JS platform, at which point existing serverjs-compliant toolkits can be leveraged? The portability problem is already solved by serverjs. Is there something in the current serverjs proposal which requires (non-ISO) date formatting?
Ah, seems like there's interest! May I recommend that someone take
responsibility for the secretarial affairs for Date related features
and begin a section on the Wiki?
Kris
These are great, and shouldn't take much effort to port. I'll see
what I can do with them.
Kris
Best regards
Mike Wilson
Devin wrote:
> I hereby propose we agree on a format method such as
> the one Steven Levithan has already cooked up
> http://stevenlevithan.com/assets/misc/date.format.js
Christoph
[1] - http://www.phparch.com/books/isbn/9780981034508
Thanks for articulating these thoughts. There are a lot of excellent
points here.
Your caja-time and caja-rrule modules are in my Narwhal branch
"calendar" as the "calendar" and "calendar/rrule" respectively. I
encourage anyone to take a look at them.
http://github.com/kriskowal/narwhal/blob/calendar/lib/calendar.js
http://github.com/kriskowal/narwhal/blob/calendar/lib/calendar/rrule.js
The calendar tests mostly pass:
http://github.com/kriskowal/narwhal/blob/calendar/tests/calendar/rrule.js
+ Running testParseIcal
Assertion Failed in testParseIcal: AssertionError: -43268096
Expected equal = "20061125"
Actual = -43268096
Passed 20; Failed 1; Error 0;
The rrule tests don't fare as well:
http://github.com/kriskowal/narwhal/blob/calendar/tests/calendar/rrule.js
Passed 4; Failed 68; Error 0;
I am a little concerned that these types are too optimized for the
calendar case to be useful as date/time moments generally since they
do not have second or sub-second resolution.
Kris Kowal