selling-partner-api icon indicating copy to clipboard operation
selling-partner-api copied to clipboard

Wrong Timezone for Datetime Deserializer

Open simonsolutions opened this issue 1 year ago • 3 comments

Problem description:

When the library deserialises the DateTimes to DateTime-Objects it uses the local Timezone of the Server. But times ending with Z are UTC timezone. So the DateTime object had the numeric value of the UTC from Amazon but had set the timezone to e.g. Europe/Berlin because of the server default.

simonsolutions avatar Jun 26 '24 11:06 simonsolutions

Proposed fix in PR https://github.com/jlevers/selling-partner-api/pull/746

simonsolutions avatar Jun 26 '24 11:06 simonsolutions

Json Response: ,"FeesEstimate": { "TimeOfFeesEstimation": "2024-06-26T11:09:40.000Z"

current behaviour:

+timeOfFeesEstimation: DateTime @1719392627 {#3539 ▼ date: 2024-06-26 11:03:47.0 Europe/Berlin (+02:00) }

simonsolutions avatar Jun 26 '24 11:06 simonsolutions

Huh, I'm not seeing this behavior – my dates deserialize into UTC by default:

image

But I guess there isn't any harm in making sure that it's the right timezone...I'll respond to the PR with a couple comments :)

jlevers avatar Jun 26 '24 15:06 jlevers

Fixed in v7.0.4.

jlevers avatar Jul 09 '24 20:07 jlevers