PDA

View Full Version : Datefield not working with format m/Y



gregoryextjs
29 Mar 2011, 8:20 AM
Hi,

the datefield is not working with format m/Y

Today is the 29 March 2011 (french) and i have a datefield with format: m/Y.

I put the value : '02/2011' and the datefield changes my value to '03/2011' because the day is not defined and the datefield adds the day "29" to my value "02/2011". But because the 29/02/2011 does not exist, the datefield changes it to '29/03/2011' -> '03/2011'.

I don't want the day in my datefield and I don't want the datefield to change my date. If there is a date problem, I just want an error message.

Ext-js version : 3.1.1
Sorry for my english.

Thanks in advance,
Greg

losinggeneration
29 Mar 2011, 9:07 AM
I had just reported the same issue :) http://www.sencha.com/forum/showthread.php?128404-Date-parses-date-incorrectly-for-February-when-no-day-is-used

gregoryextjs
29 Mar 2011, 9:10 AM
I just saw it a minute ago

Sorry :)

losinggeneration
29 Mar 2011, 10:03 AM
Quite alright. I'm just glad someone else noticed it. You did give me a hint that allows me to work around the issue (though it works for me because each application is pretty self contained. For bigger projects this probably wouldn't work.) What I'm doing is setting the Date.default.d = 15 so it's not using todays date. This guarantees the day is in the current month.

gregoryextjs
29 Mar 2011, 11:35 PM
I added this code to my prototype file :

Ext.apply(Date.defaults, {
d: 15 // default to first day of the month
});

and it works fine !!

Thank you !!!!!!

Greg

optiplex
30 Mar 2011, 12:27 AM
don't worry
i will try it.