date-fns-tz
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -159,3 +159,3 @@ import toInteger from 'date-fns/esm/_lib/toInteger/index.js' | ||
dateStrings.timezone || options.timeZone, | ||
new Date(timestamp + time) | ||
date | ||
) | ||
@@ -162,0 +162,0 @@ if (isNaN(offset)) { |
@@ -43,3 +43,3 @@ import tzParseTimezone from '../_lib/tzParseTimezone' | ||
// We just need to apply the offset indicated by the time zone to this localized date | ||
var offsetMilliseconds = tzParseTimezone(timeZone, date) | ||
var offsetMilliseconds = tzParseTimezone(timeZone, utcDate) | ||
@@ -46,0 +46,0 @@ return offsetMilliseconds |
{ | ||
"name": "date-fns-tz", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "description": "Time zone support for date-fns v2 with the browser Intl API", |
@@ -35,3 +35,3 @@ # date-fns-tz | ||
Libraries like Moment and Luxon, which provide their own date time classes, manage these timestamp and time | ||
zone values internally. Sine `date-fns` always returns a plain JS Date, which implicitly has the current | ||
zone values internally. Since `date-fns` always returns a plain JS Date, which implicitly has the current | ||
system's time zone, helper functions are provided for handling common time zone related use cases. | ||
@@ -38,0 +38,0 @@ |
@@ -138,3 +138,3 @@ "use strict"; | ||
if (dateStrings.timezone || options.timeZone) { | ||
offset = (0, _tzParseTimezone.default)(dateStrings.timezone || options.timeZone, new Date(timestamp + time)); | ||
offset = (0, _tzParseTimezone.default)(dateStrings.timezone || options.timeZone, date); | ||
@@ -141,0 +141,0 @@ if (isNaN(offset)) { |
@@ -45,3 +45,3 @@ "use strict"; | ||
var offsetMilliseconds = (0, _tzParseTimezone.default)(timeZone, date); | ||
var offsetMilliseconds = (0, _tzParseTimezone.default)(timeZone, utcDate); | ||
return offsetMilliseconds ? (0, _subMilliseconds.default)(utcDate, offsetMilliseconds) : utcDate; | ||
@@ -48,0 +48,0 @@ } |
168517