@sprucelabs/calendar-utils 39.0.0 → 39.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,11 +27,13 @@ export default class LocaleImpl extends AbstractEventEmitter {
27
27
  this.currentZone = undefined;
28
28
  }
29
29
  getTimezoneOffsetMinutes(onDate, timezone) {
30
- if (onDate) {
31
- const dateRoundedToNearestHour = onDate - (onDate % 3600000);
32
- const key = `${this.getZoneName()}-${dateRoundedToNearestHour}`;
30
+ if (onDate || timezone) {
31
+ const date = onDate ? onDate : Date.now();
32
+ const dateRoundedToNearestHour = date - (date % 3600000);
33
+ const zone = timezone !== null && timezone !== void 0 ? timezone : this.getZoneName();
34
+ const key = `${zone}-${dateRoundedToNearestHour}`;
33
35
  if (!(key in this.offsetsForDate)) {
34
- this.offsetsForDate[key] = this.zoneNameToOffsetMinutes(timezone !== null && timezone !== void 0 ? timezone : this.getZoneName(), onDate);
36
+ this.offsetsForDate[key] = this.zoneNameToOffsetMinutes(zone, onDate);
35
37
  }
36
38
  return this.offsetsForDate[key];
37
39
  }
@@ -23,11 +23,13 @@ class LocaleImpl extends mercury_event_emitter_1.AbstractEventEmitter {
23
23
  this.currentZone = undefined;
24
24
  }
25
25
  getTimezoneOffsetMinutes(onDate, timezone) {
26
- if (onDate) {
27
- const dateRoundedToNearestHour = onDate - (onDate % 3600000);
28
- const key = `${this.getZoneName()}-${dateRoundedToNearestHour}`;
26
+ if (onDate || timezone) {
27
+ const date = onDate ? onDate : Date.now();
28
+ const dateRoundedToNearestHour = date - (date % 3600000);
29
+ const zone = timezone !== null && timezone !== void 0 ? timezone : this.getZoneName();
30
+ const key = `${zone}-${dateRoundedToNearestHour}`;
29
31
  if (!(key in this.offsetsForDate)) {
30
- this.offsetsForDate[key] = this.zoneNameToOffsetMinutes(timezone !== null && timezone !== void 0 ? timezone : this.getZoneName(), onDate);
32
+ this.offsetsForDate[key] = this.zoneNameToOffsetMinutes(zone, onDate);
31
33
  }
32
34
  return this.offsetsForDate[key];
33
35
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "39.0.0",
6
+ "version": "39.0.1",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",