Thanks Bob! I am already doing this, but It kind of looked hacky to me. So
the question.Now I am happy that I am doing the right thing.
thanks for all the inputs
~
Prathap
On 12/11/06, Bob Ippolito <[EMAIL PROTECTED]> wrote:
>
> Well, toISODate(isoDate(s)) == s is an invariant for (only) correctly
> formatted dates.
>
> validatedISODate = function (s) {
> var d = isoDate(s);
> if (toISODate(d) != s) {
> return null;
> }
> return d;
> };
>
> -bob
>
> On 12/11/06, Prathap(பிரதாப் நிர்மல்) <[EMAIL PROTECTED]> wrote:
> > The user selects the date using a JavaScript based calendar, which
> returns a
> > date in ISO format. The returned value is populated in a text box, which
> the
> > user can edit. The problem here is the user will be able to edit the
> date
> > that is populated back in the text box. So I am looking for options to
> > validate my date before the user can submit the form.
> >
> > Thanks
> >
> > ~
> > Prathap
> >
> > On 12/11/06, Bob Ippolito <[EMAIL PROTECTED]> wrote:
> > > The profile of ISO 8601 it intends to support definitely does require
> > hyphens.
> > >
> > > http://www.w3.org/TR/NOTE-datetime
> > >
> > > The JavaScript Date object doesn't handle ISO 8601 style dates at all,
> > > at least in its constructor:
> > > >>> new Date("2006")
> > > Invalid Date
> > > >>> new Date("2006-11")
> > > Invalid Date
> > > >>> new Date("2006-11-23")
> > > Invalid Date
> > >
> > > While isoDate could attempt to validate dates, it would add a lot of
> > > complexity to the code and probably not solve any problems that people
> > > actually have. Did you actually run into a situation where date
> > > validation would've saved you time or effort, or were you simply
> > > throwing invalid dates at the function to see what would happen?
> > >
> > > The only real need I see for validation would be if it was intended
> > > for user input.. but you'd want something more flexible for user
> > > input. ISO style dates are for machines.
> > >
> > > -bob
> > >
> > > On 12/11/06, Prathap(பிரதாப் நிர்மல்) <[EMAIL PROTECTED]> wrote:
> > > > Hi Bob,
> > > > Thanks for the reply. But it will be great if we can do something
> more
> > > > that what Javascript Date object does. Also the isoDate can't be
> used
> > with
> > > > simple formats like isoDate('20061123') whereas the default Date can
> be.
> > Is
> > > > there any reason on why the isoDate function is restricted to dates
> > > > separated by '-' character? The 8601 doesn't seem to specify any
> such
> > > > restrictions. Thanks again for your input and for such a great
> library!
> > > >
> > > > ~
> > > > Prathap
> > > >
> > > > On 12/11/06, Bob Ippolito < [EMAIL PROTECTED]> wrote:
> > > > > It's not a bug, that's what the JavaScript Date object does. I
> don't
> > > > > see a particularly good reason to "fix" this.
> > > > >
> > > > > -bob
> > > > >
> > > > >
> > > > > On 12/11/06, Nirmal <[EMAIL PROTECTED] > wrote:
> > > > > >
> > > > > > Hi All,
> > > > > > I noticed that the date library in MochiKit behaves
> differently,
> > > > > >
> > > > > > isoDate('2006-34-34') gives Mon Nov 03 2008 00:00:00 GMT+0530
> > (India
> > > > > > Standard Time)
> > > > > >
> > > > > > The month and date values above are invalid. But it ads up to
> the
> > date
> > > > > > value, its like find the date of the day that is 34 months and
> 34
> > days
> > > > > > after 2006-Jan'01. But the ISO 8601 spec specifies a limit on
> the
> > > > > > values ->
> > > > > >
> > > > > > MM = two-digit month (01=January, etc.)
> > > > > > DD = two-digit day of month (01 through 31)
> > > > > >
> > > > > > So is this a bug in mochikit? I will be happy to fix it.
> > > > > >
> > > > > > ~
> > > > > > Prathap
> > > > > >
> > > > > >
> > > > > >
> > > > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > பிரதாப் நிர்மல்
> > > > Web Applications Engineer
> > > > Google Online India Pvt. Ltd.
> > > > 7th Floor, Jayabheri Silicon Towers,
> > > > Madhapur Road, Kondapur
> > > > Hyderabad - 500 032
> > > > mobile : +91 99856 34636
> > >
> >
> >
> >
> > --
> >
> > பிரதாப் நிர்மல்
> > Web Applications Engineer
> > Google Online India Pvt. Ltd.
> > 7th Floor, Jayabheri Silicon Towers,
> > Madhapur Road, Kondapur
> > Hyderabad - 500 032
> > mobile : +91 99856 34636
>
--
பிரதாப் நிர்மல்
Web Applications Engineer
Google Online India Pvt. Ltd.
7th Floor, Jayabheri Silicon Towers,
Madhapur Road, Kondapur
Hyderabad - 500 032
mobile : +91 99856 34636
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---