Is this possible?

16 views
Skip to first unread message

infringer

unread,
Oct 7, 2009, 3:49:01 PM10/7/09
to Datejs - A JavaScript Date Library
Hi,

I have currently modified my DateJS and my formats section looks like
this:
g._formats = g.formats([
"\"yyyy-MM-ddTHH:mm:ssZ\"",
"yyyy-MM-ddTHH:mm:ssZ",
"yyyy-MM-ddTHH:mm:ssz",
"yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-ddTHH:mmZ",
"yyyy-MM-ddTHH:mmz",
"yyyy-MM-ddTHH:mm",
"ddd, MMM dd, yyyy H:mm:ss tt",
"ddd MMM d yyyy HH:mm:ss zzz",
"MMddyyyy",
"ddMMyyyy",
"Mddyyyy",
"ddMyyyy",
"MMddyy",
"Mdyyyy",
"dMyyyy",
"MMdd",
"yyyy",
"Mdyy",
"dMyy",
"d"
]);

I needed the ability to type MMdd or MMddyy and get a valid date.

Now the question is, is there any way to know whether the user
supplied a year or the library just assumed current year?

Here's what I'm trying to do. Today is 10/7, so anytime any user
types 1007 it returns 10/07/09... If they type 1101 it returns
11/01/09. Now what I want is it to anydate less than 10/7 to return
as next year. Such as 1006 should return 10/06/10... and I am able to
do this. But I also need the ability to specify the year. Currently
there would be no way for the user to get 10/06/09 returned.

I just need some way of know if the user supplied a year or not?

Is this possible?
Thanks,
-Davd
Reply all
Reply to author
Forward
0 new messages