Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fix: add temp fix to uniform TZ
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jul 3, 2020
1 parent 16ba997 commit 692af1b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
10 changes: 9 additions & 1 deletion src/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ export const mwsBoolean = Codec.custom<boolean>({
})

export const mwsDate = Codec.custom<Date>({
decode: (x) => string.decode(x).chain((aString) => date.decode(decodeURIComponent(aString))),
decode: (x) =>
string.decode(x).chain((aString) => {
let toDecode = aString
// Temp fix. Add UTC if no letter is found in "param" passed
if (!/[A-Za-z]/g.test(aString)) {
toDecode += ' UTC+00:00'
}
return date.decode(decodeURIComponent(toDecode))
}),
encode: date.encode,
schema: date.schema,
})
Expand Down
6 changes: 3 additions & 3 deletions test/unit/__snapshots__/merchant-fulfillment.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,14 @@ Array [
"PNG",
],
"CarrierName": "UPS",
"EarliestEstimatedDeliveryDate": 2018-10-17T18:00:00.000Z,
"LatestEstimatedDeliveryDate": 2018-10-17T18:00:00.000Z,
"EarliestEstimatedDeliveryDate": 2018-10-18T02:00:00.000Z,
"LatestEstimatedDeliveryDate": 2018-10-18T02:00:00.000Z,
"Rate": Object {
"Amount": 16.83,
"CurrencyCode": "USD",
},
"RequiresAdditionalSellerInputs": false,
"ShipDate": 2018-10-15T23:41:12.000Z,
"ShipDate": 2018-10-16T07:41:12.000Z,
"ShippingServiceId": "UPS_PTP_GND",
"ShippingServiceName": "UPS Ground",
"ShippingServiceOfferId": "ly51yzA1nAXlJzmYlKaH+7WbKOWz2BTujIOPx5PU8luilmZYK/JFhbx177aKey8MdZcG90uABbT5q8WAgPI+uxcxx/XDtIbI7c161j5spbfsiPTwIJg4Bk66bnP6Ip+JJtuSU5++rAdv4mzXvKpisLGYGrc+FuJvBAjTersJhq4=",
Expand Down
23 changes: 0 additions & 23 deletions test/unit/codec.test.ts

This file was deleted.

0 comments on commit 692af1b

Please sign in to comment.