View Full Version : Date format in datepicker
martin meijer
9 Jun 2008, 4:50 AM
On the last tab on my field properties I entered xnd-date on the Class tag. The result is a nice datepicker that has te format MM/DD/YY. I want to chanche this format to DD-MM-YYYY. How can I do this?
RWaters
10 Jun 2008, 5:52 AM
We're not setting the date format explicitly, we let Ext pick the default so that if you include a different locale file you will get that proper date format.
From the ext-lang-en_UK file:
if(Ext.util.Format){
Ext.util.Format.date = function(v, format){
if(!v) return "";
if(!(v instanceof Date)) v = new Date(Date.parse(v));
return v.dateFormat(format || "d/m/Y");
};
}
if(Ext.DatePicker){
Ext.apply(Ext.DatePicker.prototype, {
todayText : "Today",
minText : "This date is before the minimum date",
maxText : "This date is after the maximum date",
disabledDaysText : "",
disabledDatesText : "",
monthNames : Date.monthNames,
dayNames : Date.dayNames,
nextText : 'Next Month (Control+Right)',
prevText : 'Previous Month (Control+Left)',
monthYearText : 'Choose a month (Control+Up/Down to move years)',
todayTip : "{0} (Spacebar)",
format : "d/m/y"
});
}
if(Ext.form.DateField){
Ext.apply(Ext.form.DateField.prototype, {
disabledDaysText : "Disabled",
disabledDatesText : "Disabled",
minText : "The date in this field must be after {0}",
maxText : "The date in this field must be before {0}",
invalidText : "{0} is not a valid date - it must be in the format {1}",
format : "d/m/y",
altFormats : "d/m/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|Y-m-d"
});
}
martin meijer
12 Jun 2008, 11:32 PM
I'm not sure what you mean by this. What kind of setting should I configure (and where can I find it) to get the dateformat I want (dd-mm-yyyy)? Is it somewhere in my OS or something in Domino?
Nicholas Hopkins
25 Jun 2008, 7:06 PM
An easy (and somewhat less elegant) way to do this for just the dates is to edit ext-all.js
You'll see the date formats in the forms section
mth96a
27 Jun 2008, 5:28 AM
Dont use the exd-date in the class property, instead give it an id and put this after form.render
var dt = new Ext.form.DateField({
name: 'date',
width: 110,
allowBlank: false,
applyTo : 'test' //id in field name
});
use
format : String
The default date format string which can be overriden for localization support. The format must be valid according to...
The default date format string which can be overriden for localization support. The format must be valid according to Date.parseDate (defaults to 'm/d/Y').
or
altFormats : String
Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined format...
Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined format (defaults to 'm/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d').
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.