REST API Time Zone offset throwing me for a loop

rest

(Jose C Gomez) #1

I’m in california this week and in my spare time I’ve been working on a little side project which involves REST. My server is in EST time and I’m in PST this week.
I am sending some data via a UBAQ using REST which contains a Date. I am sending it to Epicor in “LocalTime” and it is “Helpfully” (not really) adjusting for time zone difference between client and server

I am sending
6/7/2018 @ 21:28
and it is recording in Epicor
6/8/2018 @ 00:28

This is fine I suppose, except when you run the BAQ (Get) it is NOT making the adjustment back to the data it gives me.So I send back 21:28 it “stores” 00:28 and it gives me 00:28 back. Which then causes me to do some date math locally on my client and come up with ± 3 hours in the span of 2 seconds.

Has anyone ran into this one? Is there a way to get it to stop adjusting my time… or let it adjust the time but behave consistently and return adjusted time back to me so that I can get some consistent data?

@Bart_Elia, @Olga


(Jose C Gomez) #2

Tried sending in CallSettings.TimeZoneOffSet header that didn’t do much.


(Andrew Murdock) #3

We had the same issue with dates in a UBAQ as well. Our users are in EST and our server is in PST so if they used a UBAQ in a Dashboard to update a date the server will save it on the previous day. (its the same issue as you, jut reversed time zones)

For example if I save a date as 6/16/2018 in the dashboard it will be saved in the database as 6/15/2018 9PM (3 hours behind)

I oped a call with Epicor in 2015 ( 1705470PSC ) and I guess they issued an SCR 165488 but we never got it.

We use terminal servers so our solution was to force the servers to always be Pacific Time.


(Steven Jones) #4

Ideally there would be a flag to indicate you’re using GMT. Then it would be up to the local client to translate.

- Steve


(Olga Klimova) #5

NOthing special is done in REST about timezones. So I suppose ODATA just deserializes it from string and use as it is.
You can compare if UpdateExt called differently for UBAQ in REST and WCF.
If you use test server for your experiments, then we can add add trace to appserver.config:
<add uri="profile://ice/fw/updateext" />

After that call UBAQ from REST and from BAQ designer and UpdateExt call will be in your serverlog.txt


(Jose C Gomez) #6

Strange… So epicor is automatically adjusting the time zone… But how does it know what time zone I’m coming from…if rest interface isn’t telling it…
The strange but I’d that it adjusts it on the way in but not on the way out…


(Olga Klimova) #7

Probably REST need to do same thing as BAQ designer and DBD do with timezones in dates. there was some special processing when dataset is returned.


(Andrew Murdock) #8

A note about our issue, It only happened in a Dashboard, not in the BAQ designer. That’s what made me crazy, the UBAQ worked fine with dates until called from a dashboard.

I wonder what REST is calling because there are clearly 2 (or more) ways the server can process a call to a UBAQ.


(Olga Klimova) #9

that issue with dashboard was closed several years ago. I remember it, but without many details.


(Andrew Murdock) #10

Thank for the update. I tried searching for the SCR or case number in EpiCare but it wasn’t converted so I wasn’t sure.


(Jose C Gomez) #11

As a work around I’m returning the Server GetDate() as a Calc_Field and doing the math between the client time and it, to figure out the offset. But it would be nice if it worked consistently on a PATCH vs GET. That is , it converted to the right time zone on both calls not just the PATCH


(Olga Klimova) #12

report it :slight_smile:


(Bart Elia) #13

What’s your Company Timezone?


(Jose C Gomez) #14

No TimeZone (available) there 10.1.600.9. Server is EST