(which is new Date())
johan
On 8/23/06, Tomer Mevorach
<[EMAIL PROTECTED]> wrote:
hi,
I have a DatePicker in my application and it works fine when its
initialized with client machine time.
I have problems initializing it with server time.
in order to initialize it with server time i use the following
DatePickerSettings and DateConverter:
private static final DateFormat dateFormat = new
SimpleDateFormat("MM/dd/yyyy HH:mm");
private static final DatePickerSettings dateSettings = new
DatePickerSettings() {
public ResourceReference getLanguage(Locale currentLocale) {
return DatePickerComponentInitializer.getLanguage(Locale.US);
}
@Override
public String toScript(Locale locale, String format) {
StringBuffer script = new StringBuffer(super.toScript(locale,
format));
//init date picker with server time
int last = script.length() - 1;
if (',' != script.charAt(last)) {
script.append(",");
}
script.append("\n\tdate : \"" + dateFormat.format(new
Date()) + "\"");
return script.toString();
}
};
private static final DateConverter dateConverter = new DateConverter() {
public DateFormat getDateFormat(Locale locale) {
return super.getDateFormat(Locale.US);
}
};
static {
dateSettings.setShowsTime(true);
dateSettings.setTimeFormat("24");
dateSettings.setWeekNumbers (false);
dateConverter.setDateFormat(Locale.US, dateFormat);
}
Here is the rendered JS:
Calendar.setup(
{
inputField : "6:provisioningForm:startDateType:startDateTypes:1:startDate",
button : "6:provisioningForm:startDateType:startDateTypes:1:startDatePicker:trigger",
weekNumbers : false,
showsTime : true,
timeFormat : 24,
ifFormat : "%m/%d/%Y %H:%M",
date : "08/22/2006 19:06"
});
Can anyone please tell my what is it that I'm doing wrong because the
calendar keeps being initialized with client time.
Regards,
Tomer
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user