Loading ...
Sorry, an error occurred while loading the content.

Full ISO 8601 Date Parser Plus Unobtrusive toISOString

Expand Messages
  • Andrea Giammarchi
    Maybe this stuff could be interesting for json2.js file as well, or maybe not. It is a quick and full specs ISO strings parser, really fast, widely compatible,
    Message 1 of 5 , Jul 4, 2009
    • 0 Attachment
      Maybe this stuff could be interesting for json2.js file as well, or maybe
      not.
      It is a quick and full specs ISO strings parser, really fast, widely
      compatible, unobtrusive, since Date.prototype is not touched (it could be
      touched if everybody agrees about it)
      http://webreflection.blogspot.com/2009/07/ecmascript-iso-date-for-every-browser.html

      Regards


      [Non-text portions of this message have been removed]
    • joel.finch@ymail.com
      Personally, I think this would have to extend the Date prototype to be fully useful; like json2.js, its value is in allowing us to write script now using the
      Message 2 of 5 , Jul 5, 2009
      • 0 Attachment
        Personally, I think this would have to extend the Date prototype to be fully useful; like json2.js, its value is in allowing us to write script now using the correct future syntax of ECMAScript 5.

        Incidentally, your toISOString function doesn't have handling for the NaN case.


        --- In json@yahoogroups.com, Andrea Giammarchi <andrea.giammarchi@...> wrote:
        >
        > Maybe this stuff could be interesting for json2.js file as well, or maybe
        > not.
        > It is a quick and full specs ISO strings parser, really fast, widely
        > compatible, unobtrusive, since Date.prototype is not touched (it could be
        > touched if everybody agrees about it)
        > http://webreflection.blogspot.com/2009/07/ecmascript-iso-date-for-every-browser.html
        >
        > Regards
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • Andrea Giammarchi
        The NaN case should be a constructor problem, no? To extend Date.prototype.toISOString = Date.ISO( 2000 ).toISOString; On Jul 6, 2009 1:41 AM,
        Message 3 of 5 , Jul 5, 2009
        • 0 Attachment
          The NaN case should be a constructor problem, no? To extend
          Date.prototype.toISOString = Date.ISO("2000").toISOString;

          On Jul 6, 2009 1:41 AM, "joel.finch@..." <joel@...> wrote:



          Personally, I think this would have to extend the Date prototype to be fully
          useful; like json2.js, its value is in allowing us to write script now using
          the correct future syntax of ECMAScript 5.

          Incidentally, your toISOString function doesn't have handling for the NaN
          case.

          --- In json@yahoogroups.com, Andrea Giammarchi <andrea.giammarchi@...>
          wrote: > > Maybe this stuff...
          > [Non-text portions of this message have been removed]
          >




          [Non-text portions of this message have been removed]
        • Arthur Blake
          Shouldn t new Date(NaN) refer to a future date that is always just around the corner, yet never arrives? sorry... couldn t resist :) On Mon, Jul 6, 2009 at
          Message 4 of 5 , Jul 9, 2009
          • 0 Attachment
            Shouldn't new Date(NaN) refer to a future date that is always just around
            the corner, yet never arrives?
            sorry... couldn't resist :)

            On Mon, Jul 6, 2009 at 2:51 AM, Andrea Giammarchi <
            andrea.giammarchi@...> wrote:

            >
            >
            > The NaN case should be a constructor problem, no? To extend
            > Date.prototype.toISOString = Date.ISO("2000").toISOString;
            >
            >
            > On Jul 6, 2009 1:41 AM, "joel.finch@... <joel.finch%40ymail.com>" <
            > joel@... <joel%402am.com.au>> wrote:
            >
            > Personally, I think this would have to extend the Date prototype to be
            > fully
            > useful; like json2.js, its value is in allowing us to write script now
            > using
            > the correct future syntax of ECMAScript 5.
            >
            > Incidentally, your toISOString function doesn't have handling for the NaN
            > case.
            >
            > --- In json@yahoogroups.com <json%40yahoogroups.com>, Andrea Giammarchi
            > <andrea.giammarchi@...>
            > wrote: > > Maybe this stuff...
            > > [Non-text portions of this message have been removed]
            > >
            >
            > [Non-text portions of this message have been removed]
            >
            >
            >


            [Non-text portions of this message have been removed]
          • Andrea Giammarchi
            Uhm, I think new Date(NaN) should return a static historical date, new Date(Number.POSITIVE_INFINITY) 9999-12-31T23:59:59:999 and Number.NEGATIVE_INFINITY
            Message 5 of 5 , Jul 9, 2009
            • 0 Attachment
              Uhm, I think new Date(NaN) should return a static historical date, new
              Date(Number.POSITIVE_INFINITY) 9999-12-31T23:59:59:999 and
              Number.NEGATIVE_INFINITY 0001-01-01T00:00:00.001 :D

              Jokes a part, if interested, I have implemented a full(?) ECMAScript Date
              constructor in vice-versa, but since vice-versa is based on stand-alone
              modules/files, here I am with the code:

              http://vice-versa.googlecode.com/svn/trunk/src/Date.js

              toISOString is a prototype, and new Date accept ISO 8601 strings.

              Regards

              On Thu, Jul 9, 2009 at 8:14 PM, Arthur Blake <arthur.blake@...> wrote:

              >
              >
              > Shouldn't new Date(NaN) refer to a future date that is always just around
              > the corner, yet never arrives?
              > sorry... couldn't resist :)
              >


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.