@shopify/dates
Advanced tools
Comparing version 0.4.1 to 0.4.2
{ | ||
"name": "@shopify/dates", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"license": "MIT", | ||
@@ -31,3 +31,3 @@ "description": "Lightweight date operations library", | ||
"devDependencies": { | ||
"@shopify/jest-dom-mocks": "^2.9.1" | ||
"@shopify/jest-dom-mocks": "^2.9.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "files": [ |
@@ -21,3 +21,3 @@ # `@shopify/dates` | ||
Takes in a date object and two optional time zone string parameters. Returns a new date object with the offset between the time zones added to it. | ||
Takes in a date object and two optional time zone string parameters. Returns a new date object with the offset between the time zones added to it. We can also assume the passed date is in the first time zone and we want to calculate it in the second time zone. | ||
@@ -31,3 +31,3 @@ ```ts | ||
const newDate = applyTimeZoneOffset(date, timeZone1, timeZone2); | ||
const newDate = applyTimeZoneOffset(date, timeZone1, timeZone2); //'2018-06-01T02:00:00.000Z' | ||
``` | ||
@@ -329,3 +329,3 @@ | ||
Takes in a date object and two optional time zone string parameters. Returns a new date object with the offset between the time zones subtracted from it. | ||
Takes in a date object and two optional time zone string parameters. Returns a new date object with the offset between the time zones subtracted from it. We can also assume the passed date is in the second time zone and we want to calculate it back in the first time zone. | ||
@@ -336,5 +336,6 @@ ```ts | ||
const date = new Date('2018-06-01Z14:00'); | ||
const timeZone = 'Australia/Perth'; | ||
const timeZone1 = 'Australia/Perth'; | ||
const timeZone2 = 'America/Toronto'; | ||
const newDate = unapplyTimeZoneOffset(date, offset); | ||
const newDate = unapplyTimeZoneOffset(date, timeZone1, timeZone2); //2018-06-02T02:00:00.000Z | ||
``` |
57019
338