Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    Hi guys! Some follow-up (now running 12.1-p20200606):

    I took your comment above "They are simply translated to the client as you would expect, and translated from client to server likewise. No settings are required." to heart and made some tests:

    I have a DS.xml with a field configured as such
    <field name="in" type="datetime" required="true">
    I made a testcase that loads one datetime row from the database and displays it in a listgrid.

    The row in question is "2020-09-23 09.00 CEST" when read up as an instant from the database.

    I have previously used java.util.Date, which works fine ofc.
    Java object: "Wed Sep 23 09:00:00 CEST 2020"
    Network value: new Date(1600844400000) #this value is 0700 GMT, or 0900 CEST as expected.
    It then displays in the browser timezone, so it works as intended.

    I was not as lucky with java.time.Instant:
    Java object: "2020-09-23T07:00:00Z"
    Network value: {nano:0,epochSecond:1600844400}
    This is 0700 GMT, which is correct.
    This ends up as [object Object] in the listgrid.

    LocalDateTime kind of worked:
    Java object: "2020-09-23T09:00" (makes sense since timezone is just stripped)
    Network value: :new Date(1600851600000) #this value is 0900 in, GMT time.
    Displays, but 2 hours (difference between CEST and GMT) is added to the value in the listgrid, since it is assumed to be GMT i guess.
    One could argue that it would make sense that the server time is displayed as-is when there is no time zone information? Tricky though.

    java.time.ZonedDateTime was crazy:
    Java object: 2020-09-23T09:00+02:00[Europe/Stockholm]
    Network value: (super large toString() i guess?) :{offset:{totalSeconds:7200,rules:{fixedOffset:true,transitionRules:[],transitions:[]},id:"+02:00"},dayOfYear:267,year:2020,nano:0,minute:0,second:0,dayOfWeek:"WEDNESDAY",hour:9,month:"SEPTEMBER",dayOfMonth:23,zone:{rules:{fixedOffset:false,transitionRules:[{localTime:new Date(3600000),dayOfMonthIndicator:25,dayOfWeek:"SUNDAY",midnightEndOfDay:false,month:"MARCH",standardOffset:{totalSeconds:3600,rules:{fixedOffset:true,transitionRules:[],transitions:[]},id:"+01:00"},timeDefinition:"UTC",offsetAfter:{totalSeconds:7200,rules:{fixedOffset:true,transitionRules:[],transitions:[]},id:"+02:00"},offsetBefore:{totalSeconds:3600,rules:{fixedOffset:true,transitionRules:[],transitions:[]},id:"+01:00"}},{localTime:new Date(3600000),dayOfMonthIn.....

    It goes on for a while, the string is approx 18000 characters! Not surprisingly, this also ends up as [object Object] in the listgrid.


    Am i doing something wrong? I got the impression that i could just switch out the java class of my transfer object to one of the new ones, and it would still work.

    Comment


      #17
      Apologies for the late response. We always preserve the actual datetime value, i.e. milliseconds since epoch, so there's never any shifts in actual time value when we send dates to the client. We've added support for java.time.Instant and java.time.ZonedDateTime types, so those will work as expected as well. These changes are available in nightly builds since Oct 27 (today). Let us know please if you have any problems after checking those out.

      Comment

      Working...
      X