@sprucelabs/calendar-utils 31.3.0 → 31.3.2

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.
@@ -2,6 +2,7 @@ import { Locale } from '../types/calendar.types';
2
2
  export default class DateParser {
3
3
  private now;
4
4
  private parsers;
5
+ protected locale: Locale;
5
6
  private constructor();
6
7
  static Parser(now: () => number, locale: Locale): DateParser;
7
8
  parse(str: string): number | null;
@@ -5,6 +5,7 @@ export default class DateParser {
5
5
  constructor(now, locale) {
6
6
  this.parsers = [];
7
7
  this.now = now;
8
+ this.locale = locale;
8
9
  const parsers = ParserFactory.Factory(now, locale);
9
10
  this.parsers = [...parsers.all()];
10
11
  }
@@ -9,7 +9,7 @@ export default class TimeParser extends AbstractParser {
9
9
  }
10
10
  if (match) {
11
11
  date.hour =
12
- parseInt(match, 10) + this.locale.getTimezoneOffsetMinutes() / 60;
12
+ parseInt(match, 10) - this.locale.getTimezoneOffsetMinutes() / 60;
13
13
  date.minute = 0;
14
14
  str = str.replace(match, '');
15
15
  }
@@ -2,6 +2,7 @@ import { Locale } from '../types/calendar.types';
2
2
  export default class DateParser {
3
3
  private now;
4
4
  private parsers;
5
+ protected locale: Locale;
5
6
  private constructor();
6
7
  static Parser(now: () => number, locale: Locale): DateParser;
7
8
  parse(str: string): number | null;
@@ -10,6 +10,7 @@ class DateParser {
10
10
  constructor(now, locale) {
11
11
  this.parsers = [];
12
12
  this.now = now;
13
+ this.locale = locale;
13
14
  const parsers = ParserFactory_1.default.Factory(now, locale);
14
15
  this.parsers = [...parsers.all()];
15
16
  }
@@ -14,7 +14,7 @@ class TimeParser extends AbstractParser_1.AbstractParser {
14
14
  }
15
15
  if (match) {
16
16
  date.hour =
17
- parseInt(match, 10) + this.locale.getTimezoneOffsetMinutes() / 60;
17
+ parseInt(match, 10) - this.locale.getTimezoneOffsetMinutes() / 60;
18
18
  date.minute = 0;
19
19
  str = str.replace(match, '');
20
20
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "31.3.0",
6
+ "version": "31.3.2",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",