Friday, 15 August 2014

Incorrect date in ExtJS 3.4.0 -



Incorrect date in ExtJS 3.4.0 -

i have problem date in extjs 3.4.0 in case when set date "01 jan 2020" extjs save "01 dec 2019"

xtype: 'datefield', id: _birthdate, format: 'd.m.y', width: 200, allowblank: false, name: 'birthdate', fieldlabel : 'date of birth'

how can prepare it?

you didn't specify how set , how saved. please show code.

but allow me elaborate on probable cause:

you off 1 month, caused fact javascript's getmonth() returns 0 jan , 11 december, while extjs builtin methods homecoming 1 jan , twelve dec (like every other sane programming language - why people js not programming language, pain in ass).

so, instance if have datefield dateformat y-m-d , do

var dt = new date(); str = dt.getfullyear() + "-" + dt.getmonth() + "-" + dt.getdate(); datefield.setvalue(str);

you off 1 month. have handle dates caution: never convert them manually, utilize ext.date.parse , ext.date.format.

date extjs

No comments:

Post a Comment