Nemo | Posts: 7

OneSpan Callback not returning GMT-0 time

0 votes

I am currently in CST/ GMT-5 but the callback is returning GMT-4 for the createdDate time.

I am on the onespan sandbox could this have an effect?

 

Edit: updated subject to GMT-0 time


Attachments
Capture_6.PNG109.11 KB
Nemo | Posts: 7

Reply to: OneSpan Callback not returning GMT-0 time

0 votes

Attached is the picture showing the event callback time.


Duo_Liang | Posts: 3776

Reply to: OneSpan Callback not returning GMT-0 time

0 votes

Hi Nemo,

 

Thanks for your post! Please note that the Date String OSS callback service returns is always in GMT time, an example looks like below:

{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_CREATE","sessionUser":"18EZDL44xgsX","packageId":"wVdZEaPD2igwUnFGJBjDD0dpO7k=","message":null,"documentId":null,"createdDate":"2018-06-30T20:04:55.384Z"}

It's in format of: yyyy-MM-dd'T'HH:mm:ss'Z'

 

In Java Code, if you are using ZonedDateTime to convert time zone, it could look like below:

GMT ---> Local

 

        ZonedDateTime gmt = ZonedDateTime.parse("2022-09-19T14:13:00Z");
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");

        String zoneId = "America/Montreal";
        ZonedDateTime zonedDateTime;
        if (zoneId.length() == 3) {
            zonedDateTime = gmt.withZoneSameInstant(ZoneId.of(zoneId, ZoneId.SHORT_IDS));
        } else {
            zonedDateTime = gmt.withZoneSameInstant(ZoneId.of(zoneId));
        }
        System.out.println(zonedDateTime.format(fmt));

 

From the screenshot you supplied, I think the 1 hour offset might be caused during this conversion 

 

 

On the opposite, if you are converting local time to GMT time, you can use code similar to below:

Local ---> GMT

        Date date = new Date();  
        String strDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); 
        ZonedDateTime utc = ZonedDateTime.parse(strDate);

        ZonedDateTime zonedDateTime2;
        if (zoneId.length() == 3) {
            zonedDateTime2 = utc.withZoneSameLocal(ZoneId.of(zoneId, ZoneId.SHORT_IDS));
        } else {
            zonedDateTime2 = utc.withZoneSameLocal(ZoneId.of(zoneId));
        }

        ZonedDateTime utcZonedDateTime = zonedDateTime2.withZoneSameInstant(ZoneOffset.UTC);
        System.out.println(utcZonedDateTime.format(fmt));

 

For time zone ID, you can get a list of OSS supported time zones from this API:
GET /api/eslTimeZones

 

Duo

 

 


Nemo | Posts: 7

Reply to: OneSpan Callback not returning GMT-0 time

0 votes

Shouldn't OneSpan callbacks be sending the timestamp using GMT-0 as mentioned here? https://www.onespan.com/blog/onespan-sign-release-1121-time-zone-support

I am aware that there is a difference between my local time and the callback time, but I was expecting the callback to send the timestamp using GMT-0 and not GMT-4
as displayed in the blog. Since I am tracking the status on our application using these timestamps, I need to know which time zone I should use.

Can you confirm that the onespan callbacks are using GMT-0 or GMT-4?


Nemo | Posts: 7

Reply to: OneSpan Callback not returning GMT-0 time

0 votes

GMT ---> Local

 

        ZonedDateTime gmt = ZonedDateTime.parse("2022-09-19T14:13:00Z");
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");

        String zoneId = "America/Montreal";

Also from this code you shared, America/Montreal is GMT-4 which seems like that is what timestamp the callback is using.


Duo_Liang | Posts: 3776

Reply to: OneSpan Callback not returning GMT-0 time

0 votes

Hi Nemo,

 

I can confirm that all time string OneSpan Sign sends to you are in GMT (GMT-0) time. A quick proof is that you can print out the callback payload in plain text and check the value. Below is an example that OSS callback service just sent to me:

{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_CREATE","sessionUser":"ATQOPd60xE4V","packageId":"3wyKgrhFUiOXnl7oC_I_3-183Qk=","message":null,"documentId":null,"createdDate":"2022-09-20T17:22:26.270Z"}

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off