@tactics/toddle-styleguide 5.4.13 → 5.4.14

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.
package/index.tsx CHANGED
@@ -111,7 +111,7 @@ import CreateResponsiveStyle from './src/theme/responsive/index';
111
111
  // ================================
112
112
  // Date / Time Utilities
113
113
  // ================================
114
- import { ClockInterface, SystemClock } from './src/utilities/datetime/clock.class';
114
+ import { ClockInterface, SystemClock, UTCSystemClock } from './src/utilities/datetime/clock.class';
115
115
  import { YearAndMonth, YearAndMonthInterface, YearAndMonthLocaleAwareOutputFormat, YearAndMonthOutputFormat } from './src/utilities/datetime/yearandmonth.class';
116
116
  import { Year, YearInterface, YearOutputFormat } from './src/utilities/datetime/year.class';
117
117
  import { SystemTimezone, TimeZone, TimeZoneInterface, UTCTimezone } from './src/utilities/datetime/timezone.class';
@@ -232,6 +232,7 @@ export {
232
232
  // Date / Time Utilities
233
233
  ClockInterface,
234
234
  SystemClock,
235
+ UTCSystemClock,
235
236
  DateOnly,
236
237
  DateOnlyInterface,
237
238
  DateOnlyLocaleAwareOutputFormat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "5.4.13",
3
+ "version": "5.4.14",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -1,11 +1,25 @@
1
1
  import {DateTime, DateTimeInterface} from './datetime.class';
2
2
  import dayjs from './dayjs-config';
3
+ import {TimeZoneInterface} from './timezone.class';
3
4
 
4
5
  export interface ClockInterface {
5
6
  now(): DateTimeInterface;
6
7
  }
7
8
 
8
9
  export class SystemClock implements ClockInterface {
10
+ private readonly timezone: TimeZoneInterface;
11
+
12
+ constructor(timezone: TimeZoneInterface) {
13
+ this.timezone = timezone;
14
+ }
15
+
16
+ public now(): DateTimeInterface {
17
+ const nowInTimezone = dayjs();
18
+ return DateTime.fromIso8601(nowInTimezone.toISOString(), this.timezone);
19
+ }
20
+ }
21
+
22
+ export class UTCSystemClock implements ClockInterface {
9
23
  public now(): DateTimeInterface {
10
24
  const nowInTimezone = dayjs();
11
25
  return DateTime.fromTimestamp(nowInTimezone.unix());