Hi all:
I'm selecting a date in a B4XPreferenceDialog, and after that, I want to compare that date with some dates in a xCLV to insertAt ordered by date.
See the comments in the code to see the problem, probably I'm missing something
See attached a B4XPages project showing the problem
I'm selecting a date in a B4XPreferenceDialog, and after that, I want to compare that date with some dates in a xCLV to insertAt ordered by date.
See the comments in the code to see the problem, probably I'm missing something
B4X:
If Result = xui.DialogResponse_Positive Then
Log(options1) 'Log output: (MyMap) {Date=1621288800000}
Log(DateTime.Date(options1.Get("Date"))) 'Log output: 05/18/2021
Log(DateTime.Date(DateTime.Now)) 'Log output: 05/18/2021
Log(DateTime.Date(DateTime.Now) & " : " & DateTime.Date(options1.Get("Date"))) 'Works Log output: 05/18/2021 : 05/18/2021. IT FAILS IF YOU CHANGE ORDER (DateTime.Now in second place) or if you try to compare with =, <, >
Log(DateTime.Date(options1.Get("Date")& " : " & DateTime.Date(DateTime.Now) )) 'FAIL java.lang.NumberFormatException: For input string: "1621288800000 : 05/18/2021"
Log(DateTime.Date(DateTime.Now) > DateTime.Date(options1.Get("Date"))) 'FAIL
End If
B4X:
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
(MyMap) {Date=1621288800000}
05/18/2021
05/18/2021
Ha ocurrido un error en la línea: 39 (B4XMainPage)
java.lang.NumberFormatException: For input string: "05/18/2021"
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.base/java.lang.Double.parseDouble(Double.java:543)
at b4j.example.b4xmainpage$ResumableSub_Button1_Click.resume(b4xmainpage.java:134)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:136)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:85)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1086)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
See attached a B4XPages project showing the problem