PDA

View Full Version : datepicker questions



nofx
27 Oct 2011, 4:25 AM
I'm using the datepicker, but i can't find some solutions for my problems.

First thing that i want is to change the dateformat. I've already added this to my code:


picker: {
yearFrom: '1920',
slotOrder: ['day', 'month', 'year']
}


When i open the datepicker then it does show it in that format dd/mm/yyyy, but when i select a date it inserts it as: mm/dd/yyy. How can i change that??

Another thing i want to know is, if it's possible to set a start date. My range is from 1920 till 2011. But i would like the datepicker to start from the year 1980 and not 1920 as most of the users will be around the age of the 80s. Iss there a way to set that option??

Möhre
27 Oct 2011, 4:33 AM
http://docs.sencha.com/touch/1-1/#!/api/Date
(http://docs.sencha.com/touch/1-1/#%21/api/Date)
{
xtype: 'datepickerfield',
picker: {
yearFrom: 1980, yearTo : 2016,
slotOrder: ['day', 'month', 'year'],
},
dateformat: 'd.m.Y',
name: 'date',
label: 'Datum'
}

nofx
27 Oct 2011, 5:03 AM
I tried your suggestion but it doesn't work.

I want the datepicker to start from 1980, but people should still be able to also pick dates before that, like 1940.

I also added "dateformat: 'd.m.Y'" but it doesn't seem to do anything. My dates still come out in the mm/dd/yyyy format.

Any other ideas?

Möhre
27 Oct 2011, 10:32 AM
I have no idear regarding question 1.

This may solve your date problem:

Add the following code in your application launch function:

Ext.apply( Ext.util.Format, {
defaultDateFormat: 'd/m/Y'
});