Skip to content

Commit

Permalink
fix(monorepo): Fixes for further circular dependency issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Sep 13, 2024
1 parent c9096a1 commit 3ebd79a
Show file tree
Hide file tree
Showing 22 changed files with 430 additions and 195 deletions.
17 changes: 17 additions & 0 deletions packages/date-time/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

export const RFC_3339_DATETIME_REGEX =
/^(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T([01]\d|2[0-3]):([0-5]\d):([0-5]\d|60))(\.\d+)?((Z)|([+|-]([01]\d|2[0-3]):[0-5]\d))$/;

Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { ErrorCode } from "@storm-stack/errors";

export type DateTimeErrorCode =
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

export * from "./constants";
export * from "./errors";
export * from "./storm-date";
Expand Down
26 changes: 24 additions & 2 deletions packages/date-time/src/storm-date-time.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { Temporal } from "@js-temporal/polyfill";
import { type JsonValue, Serializable } from "@storm-stack/serialization";
import {
Expand Down Expand Up @@ -305,7 +322,7 @@ export class StormDateTime extends Date {
return value.isValid;
}
if (isInstant(value)) {
return !!value.epochMilliseconds;
return Boolean(value.epochMilliseconds);
}

let datetime: string | undefined;
Expand Down Expand Up @@ -644,7 +661,12 @@ export class StormDateTime extends Date {
): number {
this.#instant = this.#instant
.toZonedDateTimeISO("UTC")
.with({ hour, minute, second, millisecond })
.with({
hour,
minute,
second,
millisecond
})
.toInstant();
this.#zonedDateTime = this.#instant.toZonedDateTime({
timeZone: this.timeZoneId,
Expand Down
20 changes: 18 additions & 2 deletions packages/date-time/src/storm-date.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { Temporal } from "@js-temporal/polyfill";
import { type JsonValue, Serializable } from "@storm-stack/serialization";
import { isBigInt, isDate, isNumber, isSetString } from "@storm-stack/types";
Expand Down Expand Up @@ -132,7 +148,7 @@ export class StormDate extends StormDateTime {
return value.isValid;
}
if (isInstant(value)) {
return !!value.epochMilliseconds;
return Boolean(value.epochMilliseconds);
}

let datetime: string | undefined;
Expand Down
22 changes: 19 additions & 3 deletions packages/date-time/src/storm-time.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { Temporal } from "@js-temporal/polyfill";
import { type JsonValue, Serializable } from "@storm-stack/serialization";
import { isBigInt, isDate, isNumber, isSetString } from "@storm-stack/types";
import { RFC_3339_TIME_REGEX } from "./constants";
import type { DateTimeInput, DateTimeOptions } from "./storm-date-time";
import { StormDateTime } from "./storm-date-time";
import { isInstant } from "./utilities";
import { isInstant } from "./utilities/is-instant";

/**
* Serializes a StormTime into a string
Expand Down Expand Up @@ -108,7 +124,7 @@ export class StormTime extends StormDateTime {
return value.isValid;
}
if (isInstant(value)) {
return !!value.epochMilliseconds;
return Boolean(value.epochMilliseconds);
}

let datetime: string | undefined;
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/format-date-time-iso.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import type { Temporal } from "@js-temporal/polyfill";
import { EMPTY_STRING } from "@storm-stack/types";
import type { StormDateTime } from "../storm-date-time";
Expand Down
33 changes: 25 additions & 8 deletions packages/date-time/src/utilities/format-date-time.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import type { Temporal } from "@js-temporal/polyfill";
import { EMPTY_STRING } from "@storm-stack/types";
import { StormDateTime } from "../storm-date-time";
Expand All @@ -21,13 +38,13 @@ export const formatDateTime = (

return dateTime
? `${dateTime.zonedDateTime
.toString({
smallestUnit,
roundingMode,
calendarName,
timeZoneName,
offset
})
.replaceAll("T", " ")}`
.toString({
smallestUnit,
roundingMode,
calendarName,
timeZoneName,
offset
})
.replaceAll("T", " ")}`
: EMPTY_STRING;
};
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/format-date.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import type { Temporal } from "@js-temporal/polyfill";
import { StormDate } from "../storm-date";
import type { StormDateTime } from "../storm-date-time";
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/format-since.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import type { Temporal } from "@js-temporal/polyfill";
import { StormError } from "@storm-stack/errors";
import { DateTimeErrorCode } from "../errors";
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/format-time.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import type { Temporal } from "@js-temporal/polyfill";
import type { StormDateTime } from "../storm-date-time";
import { StormTime } from "../storm-time";
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

export * from "./format-date";
export * from "./format-date-time";
export * from "./format-date-time-iso";
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/is-date-time.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { StormDateTime } from "../storm-date-time";

/**
Expand Down
17 changes: 17 additions & 0 deletions packages/date-time/src/utilities/is-instant.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*-------------------------------------------------------------------
⚡ Storm Software - Storm Stack
This code was released as part of the Storm Stack project. Storm Stack
is maintained by Storm Software under the Apache-2.0 License, and is
free for commercial and private use. For more information, please visit
our licensing page.
Website: https://stormsoftware.com
Repository: https://github.com/storm-software/storm-stack
Documentation: https://stormsoftware.com/projects/storm-stack/docs
Contact: https://stormsoftware.com/contact
License: https://stormsoftware.com/projects/storm-stack/license
-------------------------------------------------------------------*/

import { Temporal } from "@js-temporal/polyfill";
import { isFunction, isSet } from "@storm-stack/types";

Expand Down
Loading

0 comments on commit 3ebd79a

Please sign in to comment.