Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

DateUtil.getDefaultDateSeparator() throws exception

$
0
0
Here's the code:
Code:


System.out.println("A:" +DateUtil.getInputFormat());
System.out.println("B:" + DateUtil.getDefaultDateSeparator());

the output is:
A:MDY
com.google.gwt.core.client.JavaScriptException: (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(31502), JavaScript object(17062), JavaScript object(31552)]): $wnd.Date.getDefaultDateSeperator is not a function
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source)

used on Wnd Firefox 24.8.1
with SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)

I try to find format witch is used by default by user system for the displaying of the DateItem.
for example:
Code:

final DataSource newDataSource = new DataSource();

DataSourceField field;
final DateItem editorType = new DateItem();
editorType.setUseTextField(true);

//the field has type FieldType.DATETIME
field = dataSource.getField( "Name" );

dtField = new DataSourceDateField(field.getName(), field.getTitle());
dtField.setEditorProperties(editorType);
newDataSource.setFields(dtField);

//copy the old data source , but it has the new field now ("Name")
newDataSource.setInheritsFrom(dataSource);
newDataSource.setUseParentFieldOrder(true);

The problem here is that I do not know the date format of the string on the client side - it can be Japanese, European or US.

The value which I save in the DB has JSONDateFormat.XML_SCHEMA format, which is yyyy-mm-dd. This way I can set it as it is in the FilterBuilder. The problem is if I want to edit filter - the old values will be in the JSONDateFormat.XML_SCHEMA format, but format taken from the Picker will be MM/DD/YY for example.
How can I find default format used by the Picker without setting it myself, like editorType.setDisplayFormat(DateDisplayFormat.TOSERIALIZEABLEDATE);.
Because then I set the format myself I will enforce my setting on the user machine. I wanted to use setting of the user machine, which can be US/European or Japanese.

Viewing all articles
Browse latest Browse all 4756

Trending Articles