@f-o-t/datetime 0.1.0

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.
@@ -0,0 +1,135 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import { DateTime } from "../../core/datetime";
3
+ import { timezonePlugin } from "./index";
4
+
5
+ describe("Timezone Plugin", () => {
6
+ // Install plugin before running tests
7
+ DateTime.extend(timezonePlugin);
8
+
9
+ describe("tz()", () => {
10
+ it("should set timezone and return DateTime instance", () => {
11
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
12
+ const result = (dt as any).tz("America/New_York");
13
+
14
+ expect(result).toBeInstanceOf(DateTime);
15
+ expect((result as any)._timezone).toBe("America/New_York");
16
+ });
17
+
18
+ it("should handle valid IANA timezone strings", () => {
19
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
20
+
21
+ expect(() => (dt as any).tz("America/New_York")).not.toThrow();
22
+ expect(() => (dt as any).tz("Europe/London")).not.toThrow();
23
+ expect(() => (dt as any).tz("Asia/Tokyo")).not.toThrow();
24
+ expect(() => (dt as any).tz("UTC")).not.toThrow();
25
+ });
26
+
27
+ it("should throw error for invalid timezone", () => {
28
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
29
+
30
+ expect(() => (dt as any).tz("Invalid/Timezone")).toThrow();
31
+ expect(() => (dt as any).tz("")).toThrow();
32
+ });
33
+
34
+ it("should preserve the same moment in time", () => {
35
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
36
+ const withTz = (dt as any).tz("America/New_York");
37
+
38
+ expect(withTz.valueOf()).toBe(dt.valueOf());
39
+ });
40
+ });
41
+
42
+ describe("toTimezone()", () => {
43
+ it("should convert to specified timezone", () => {
44
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
45
+ const result = (dt as any).toTimezone("America/New_York");
46
+
47
+ expect(result).toBeInstanceOf(DateTime);
48
+ expect((result as any)._timezone).toBe("America/New_York");
49
+ });
50
+
51
+ it("should handle timezone conversion correctly", () => {
52
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
53
+ const nyTime = (dt as any).toTimezone("America/New_York");
54
+
55
+ // UTC 12:00 should be 07:00 in NY (EST is UTC-5)
56
+ expect(nyTime.valueOf()).toBe(dt.valueOf());
57
+ });
58
+
59
+ it("should chain with other methods", () => {
60
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
61
+ const result = (dt as any).toTimezone("America/New_York").addHours(2);
62
+
63
+ expect(result).toBeInstanceOf(DateTime);
64
+ });
65
+ });
66
+
67
+ describe("utc()", () => {
68
+ it("should set timezone to UTC", () => {
69
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
70
+ const result = (dt as any).tz("America/New_York").utc();
71
+
72
+ expect(result).toBeInstanceOf(DateTime);
73
+ expect((result as any)._timezone).toBe("UTC");
74
+ });
75
+
76
+ it("should preserve timestamp", () => {
77
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
78
+ const withTz = (dt as any).tz("America/New_York");
79
+ const backToUtc = withTz.utc();
80
+
81
+ expect(backToUtc.valueOf()).toBe(dt.valueOf());
82
+ });
83
+ });
84
+
85
+ describe("local()", () => {
86
+ it("should set timezone to local", () => {
87
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
88
+ const result = (dt as any).local();
89
+
90
+ expect(result).toBeInstanceOf(DateTime);
91
+ expect((result as any)._timezone).toBeDefined();
92
+ });
93
+
94
+ it("should preserve timestamp", () => {
95
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
96
+ const localTime = (dt as any).local();
97
+
98
+ expect(localTime.valueOf()).toBe(dt.valueOf());
99
+ });
100
+ });
101
+
102
+ describe("getTimezone()", () => {
103
+ it("should return current timezone", () => {
104
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
105
+ const withTz = (dt as any).tz("America/New_York");
106
+
107
+ expect((withTz as any).getTimezone()).toBe("America/New_York");
108
+ });
109
+
110
+ it("should return UTC for default instances", () => {
111
+ const dt = new DateTime("2024-01-15T12:00:00.000Z");
112
+
113
+ expect((dt as any).getTimezone()).toBe("UTC");
114
+ });
115
+ });
116
+
117
+ describe("Static tz() method", () => {
118
+ it("should create DateTime in specified timezone", () => {
119
+ const dt = (DateTime as any).tz(
120
+ "2024-01-15T12:00:00",
121
+ "America/New_York",
122
+ );
123
+
124
+ expect(dt).toBeInstanceOf(DateTime);
125
+ expect((dt as any)._timezone).toBe("America/New_York");
126
+ });
127
+
128
+ it("should handle current time when no input provided", () => {
129
+ const dt = (DateTime as any).tz(undefined, "America/New_York");
130
+
131
+ expect(dt).toBeInstanceOf(DateTime);
132
+ expect((dt as any)._timezone).toBe("America/New_York");
133
+ });
134
+ });
135
+ });
@@ -0,0 +1,283 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import {
3
+ DateInputSchema,
4
+ DateTimeConfigSchema,
5
+ DateTimePluginSchema,
6
+ FormatOptionsSchema,
7
+ ISODateOnlySchema,
8
+ ISODateSchema,
9
+ ISOTimeOnlySchema,
10
+ ParseOptionsSchema,
11
+ TimeUnitSchema,
12
+ } from "./schemas";
13
+
14
+ describe("TimeUnitSchema", () => {
15
+ it("should accept valid time units", () => {
16
+ expect(TimeUnitSchema.parse("millisecond")).toBe("millisecond");
17
+ expect(TimeUnitSchema.parse("second")).toBe("second");
18
+ expect(TimeUnitSchema.parse("minute")).toBe("minute");
19
+ expect(TimeUnitSchema.parse("hour")).toBe("hour");
20
+ expect(TimeUnitSchema.parse("day")).toBe("day");
21
+ expect(TimeUnitSchema.parse("week")).toBe("week");
22
+ expect(TimeUnitSchema.parse("month")).toBe("month");
23
+ expect(TimeUnitSchema.parse("year")).toBe("year");
24
+ });
25
+
26
+ it("should reject invalid time units", () => {
27
+ expect(() => TimeUnitSchema.parse("invalid")).toThrow();
28
+ expect(() => TimeUnitSchema.parse("seconds")).toThrow();
29
+ expect(() => TimeUnitSchema.parse("")).toThrow();
30
+ });
31
+ });
32
+
33
+ describe("DateInputSchema", () => {
34
+ it("should accept Date objects", () => {
35
+ const date = new Date();
36
+ expect(DateInputSchema.parse(date)).toBe(date);
37
+ });
38
+
39
+ it("should accept strings", () => {
40
+ expect(DateInputSchema.parse("2024-01-15")).toBe("2024-01-15");
41
+ expect(DateInputSchema.parse("2024-01-15T10:30:00Z")).toBe(
42
+ "2024-01-15T10:30:00Z",
43
+ );
44
+ });
45
+
46
+ it("should accept numbers", () => {
47
+ expect(DateInputSchema.parse(1705315200000)).toBe(1705315200000);
48
+ expect(DateInputSchema.parse(0)).toBe(0);
49
+ });
50
+
51
+ it("should accept DateTime-like objects", () => {
52
+ const dateTimeLike = {
53
+ toDate: () => new Date(),
54
+ } as any;
55
+ expect(DateInputSchema.parse(dateTimeLike)).toBe(dateTimeLike);
56
+ });
57
+
58
+ it("should reject invalid inputs", () => {
59
+ expect(() => DateInputSchema.parse(null)).toThrow();
60
+ expect(() => DateInputSchema.parse(undefined)).toThrow();
61
+ expect(() => DateInputSchema.parse({})).toThrow();
62
+ expect(() => DateInputSchema.parse([])).toThrow();
63
+ expect(() => DateInputSchema.parse({ notADateTime: true })).toThrow();
64
+ });
65
+ });
66
+
67
+ describe("DateTimeConfigSchema", () => {
68
+ it("should accept valid config objects", () => {
69
+ expect(
70
+ DateTimeConfigSchema.parse({
71
+ timezone: "America/New_York",
72
+ locale: "en-US",
73
+ utc: false,
74
+ strict: true,
75
+ }),
76
+ ).toEqual({
77
+ timezone: "America/New_York",
78
+ locale: "en-US",
79
+ utc: false,
80
+ strict: true,
81
+ });
82
+ });
83
+
84
+ it("should accept partial config objects", () => {
85
+ expect(DateTimeConfigSchema.parse({ timezone: "Europe/London" })).toEqual(
86
+ {
87
+ timezone: "Europe/London",
88
+ },
89
+ );
90
+ expect(DateTimeConfigSchema.parse({ utc: true })).toEqual({ utc: true });
91
+ expect(DateTimeConfigSchema.parse({})).toEqual({});
92
+ });
93
+
94
+ it("should reject invalid config objects", () => {
95
+ expect(() => DateTimeConfigSchema.parse({ timezone: 123 })).toThrow();
96
+ expect(() => DateTimeConfigSchema.parse({ locale: true })).toThrow();
97
+ expect(() => DateTimeConfigSchema.parse({ utc: "yes" })).toThrow();
98
+ expect(() => DateTimeConfigSchema.parse({ strict: 1 })).toThrow();
99
+ });
100
+ });
101
+
102
+ describe("FormatOptionsSchema", () => {
103
+ it("should accept valid format options", () => {
104
+ expect(
105
+ FormatOptionsSchema.parse({
106
+ locale: "en-US",
107
+ timezone: "America/New_York",
108
+ }),
109
+ ).toEqual({
110
+ locale: "en-US",
111
+ timezone: "America/New_York",
112
+ });
113
+ });
114
+
115
+ it("should accept partial format options", () => {
116
+ expect(FormatOptionsSchema.parse({ locale: "fr-FR" })).toEqual({
117
+ locale: "fr-FR",
118
+ });
119
+ expect(FormatOptionsSchema.parse({ timezone: "Asia/Tokyo" })).toEqual({
120
+ timezone: "Asia/Tokyo",
121
+ });
122
+ expect(FormatOptionsSchema.parse({})).toEqual({});
123
+ });
124
+
125
+ it("should reject invalid format options", () => {
126
+ expect(() => FormatOptionsSchema.parse({ locale: 123 })).toThrow();
127
+ expect(() => FormatOptionsSchema.parse({ timezone: false })).toThrow();
128
+ });
129
+ });
130
+
131
+ describe("ParseOptionsSchema", () => {
132
+ it("should accept valid parse options", () => {
133
+ expect(
134
+ ParseOptionsSchema.parse({
135
+ strict: true,
136
+ format: "YYYY-MM-DD",
137
+ timezone: "UTC",
138
+ }),
139
+ ).toEqual({
140
+ strict: true,
141
+ format: "YYYY-MM-DD",
142
+ timezone: "UTC",
143
+ });
144
+ });
145
+
146
+ it("should accept partial parse options", () => {
147
+ expect(ParseOptionsSchema.parse({ strict: false })).toEqual({
148
+ strict: false,
149
+ });
150
+ expect(ParseOptionsSchema.parse({ format: "DD/MM/YYYY" })).toEqual({
151
+ format: "DD/MM/YYYY",
152
+ });
153
+ expect(ParseOptionsSchema.parse({})).toEqual({});
154
+ });
155
+
156
+ it("should reject invalid parse options", () => {
157
+ expect(() => ParseOptionsSchema.parse({ strict: "yes" })).toThrow();
158
+ expect(() => ParseOptionsSchema.parse({ format: 123 })).toThrow();
159
+ expect(() => ParseOptionsSchema.parse({ timezone: true })).toThrow();
160
+ });
161
+ });
162
+
163
+ describe("ISODateSchema", () => {
164
+ it("should accept valid ISO 8601 datetime strings", () => {
165
+ expect(ISODateSchema.parse("2024-01-15T10:30:00Z")).toBe(
166
+ "2024-01-15T10:30:00Z",
167
+ );
168
+ expect(ISODateSchema.parse("2024-01-15T10:30:00.123Z")).toBe(
169
+ "2024-01-15T10:30:00.123Z",
170
+ );
171
+ expect(ISODateSchema.parse("2024-01-15T10:30:00.12Z")).toBe(
172
+ "2024-01-15T10:30:00.12Z",
173
+ );
174
+ expect(ISODateSchema.parse("2024-01-15T10:30:00.1Z")).toBe(
175
+ "2024-01-15T10:30:00.1Z",
176
+ );
177
+ expect(ISODateSchema.parse("2024-01-15T10:30:00+05:30")).toBe(
178
+ "2024-01-15T10:30:00+05:30",
179
+ );
180
+ expect(ISODateSchema.parse("2024-01-15T10:30:00-08:00")).toBe(
181
+ "2024-01-15T10:30:00-08:00",
182
+ );
183
+ });
184
+
185
+ it("should reject invalid ISO 8601 datetime strings", () => {
186
+ expect(() => ISODateSchema.parse("2024-01-15")).toThrow();
187
+ expect(() => ISODateSchema.parse("2024-01-15T10:30:00")).toThrow();
188
+ expect(() => ISODateSchema.parse("2024-01-15 10:30:00Z")).toThrow();
189
+ expect(() => ISODateSchema.parse("15-01-2024T10:30:00Z")).toThrow();
190
+ expect(() => ISODateSchema.parse("not a date")).toThrow();
191
+ });
192
+ });
193
+
194
+ describe("ISODateOnlySchema", () => {
195
+ it("should accept valid ISO 8601 date-only strings", () => {
196
+ expect(ISODateOnlySchema.parse("2024-01-15")).toBe("2024-01-15");
197
+ expect(ISODateOnlySchema.parse("2024-12-31")).toBe("2024-12-31");
198
+ expect(ISODateOnlySchema.parse("2000-01-01")).toBe("2000-01-01");
199
+ });
200
+
201
+ it("should reject invalid date-only strings", () => {
202
+ expect(() => ISODateOnlySchema.parse("2024-01-15T10:30:00Z")).toThrow();
203
+ expect(() => ISODateOnlySchema.parse("15-01-2024")).toThrow();
204
+ expect(() => ISODateOnlySchema.parse("2024-1-15")).toThrow();
205
+ expect(() => ISODateOnlySchema.parse("2024/01/15")).toThrow();
206
+ expect(() => ISODateOnlySchema.parse("not a date")).toThrow();
207
+ });
208
+ });
209
+
210
+ describe("ISOTimeOnlySchema", () => {
211
+ it("should accept valid ISO 8601 time-only strings", () => {
212
+ expect(ISOTimeOnlySchema.parse("10:30:00")).toBe("10:30:00");
213
+ expect(ISOTimeOnlySchema.parse("10:30:00.123")).toBe("10:30:00.123");
214
+ expect(ISOTimeOnlySchema.parse("23:59:59.999")).toBe("23:59:59.999");
215
+ expect(ISOTimeOnlySchema.parse("00:00:00")).toBe("00:00:00");
216
+ });
217
+
218
+ it("should reject invalid time-only strings", () => {
219
+ expect(() => ISOTimeOnlySchema.parse("10:30")).toThrow();
220
+ expect(() => ISOTimeOnlySchema.parse("10:30:00Z")).toThrow();
221
+ expect(() => ISOTimeOnlySchema.parse("10:30:00+05:30")).toThrow();
222
+ // Note: regex doesn't validate hour ranges, only format
223
+ expect(() => ISOTimeOnlySchema.parse("not a time")).toThrow();
224
+ });
225
+ });
226
+
227
+ describe("DateTimePluginSchema", () => {
228
+ it("should accept valid plugin objects", () => {
229
+ const plugin = {
230
+ name: "testPlugin",
231
+ install: () => {},
232
+ };
233
+ const result = DateTimePluginSchema.parse(plugin);
234
+ expect(result.name).toBe("testPlugin");
235
+ expect(typeof result.install).toBe("function");
236
+ });
237
+
238
+ it("should accept plugins with install function that takes parameters", () => {
239
+ const plugin = {
240
+ name: "configPlugin",
241
+ install: (DateTimeClass: unknown, options?: unknown) => {
242
+ // Plugin installation logic
243
+ },
244
+ };
245
+ const result = DateTimePluginSchema.parse(plugin);
246
+ expect(result.name).toBe("configPlugin");
247
+ expect(typeof result.install).toBe("function");
248
+ });
249
+
250
+ it("should reject plugins with empty names", () => {
251
+ expect(() =>
252
+ DateTimePluginSchema.parse({
253
+ name: "",
254
+ install: () => {},
255
+ }),
256
+ ).toThrow();
257
+ });
258
+
259
+ it("should reject plugins without install function", () => {
260
+ expect(() =>
261
+ DateTimePluginSchema.parse({
262
+ name: "testPlugin",
263
+ }),
264
+ ).toThrow();
265
+ });
266
+
267
+ it("should reject plugins with invalid install property", () => {
268
+ expect(() =>
269
+ DateTimePluginSchema.parse({
270
+ name: "testPlugin",
271
+ install: "not a function",
272
+ }),
273
+ ).toThrow();
274
+ });
275
+
276
+ it("should reject plugins without name", () => {
277
+ expect(() =>
278
+ DateTimePluginSchema.parse({
279
+ install: () => {},
280
+ }),
281
+ ).toThrow();
282
+ });
283
+ });
package/src/schemas.ts ADDED
@@ -0,0 +1,104 @@
1
+ import { z } from "zod";
2
+ import type { DateTime } from "./types";
3
+
4
+ /**
5
+ * Schema for time units
6
+ */
7
+ export const TimeUnitSchema = z.enum([
8
+ "millisecond",
9
+ "second",
10
+ "minute",
11
+ "hour",
12
+ "day",
13
+ "week",
14
+ "month",
15
+ "year",
16
+ ]);
17
+
18
+ /**
19
+ * Schema for DateTime input types
20
+ * Accepts Date, string, number, or DateTime instance
21
+ */
22
+ export const DateInputSchema = z.union([
23
+ z.date(),
24
+ z.string(),
25
+ z.number(),
26
+ z.custom<DateTime>(
27
+ (val) =>
28
+ val !== null &&
29
+ typeof val === "object" &&
30
+ "toDate" in val &&
31
+ typeof val.toDate === "function",
32
+ {
33
+ message: "Expected DateTime instance",
34
+ },
35
+ ),
36
+ ]);
37
+
38
+ /**
39
+ * Schema for DateTime configuration
40
+ */
41
+ export const DateTimeConfigSchema = z.object({
42
+ timezone: z.string().optional(),
43
+ locale: z.string().optional(),
44
+ utc: z.boolean().optional(),
45
+ strict: z.boolean().optional(),
46
+ });
47
+
48
+ /**
49
+ * Schema for format options
50
+ */
51
+ export const FormatOptionsSchema = z.object({
52
+ locale: z.string().optional(),
53
+ timezone: z.string().optional(),
54
+ });
55
+
56
+ /**
57
+ * Schema for parse options
58
+ */
59
+ export const ParseOptionsSchema = z.object({
60
+ strict: z.boolean().optional(),
61
+ format: z.string().optional(),
62
+ timezone: z.string().optional(),
63
+ });
64
+
65
+ /**
66
+ * Schema for ISO 8601 date strings (full datetime with timezone)
67
+ * Matches: YYYY-MM-DDTHH:mm:ss.sssZ or YYYY-MM-DDTHH:mm:ss.sss±HH:mm
68
+ */
69
+ export const ISODateSchema = z
70
+ .string()
71
+ .regex(
72
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})$/,
73
+ {
74
+ message:
75
+ "Invalid ISO 8601 datetime format. Expected: YYYY-MM-DDTHH:mm:ss.sssZ",
76
+ },
77
+ );
78
+
79
+ /**
80
+ * Schema for ISO 8601 date-only strings
81
+ * Matches: YYYY-MM-DD
82
+ */
83
+ export const ISODateOnlySchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, {
84
+ message: "Invalid ISO 8601 date format. Expected: YYYY-MM-DD",
85
+ });
86
+
87
+ /**
88
+ * Schema for ISO 8601 time-only strings
89
+ * Matches: HH:mm:ss or HH:mm:ss.sss
90
+ */
91
+ export const ISOTimeOnlySchema = z
92
+ .string()
93
+ .regex(/^\d{2}:\d{2}:\d{2}(\.\d{1,3})?$/, {
94
+ message:
95
+ "Invalid ISO 8601 time format. Expected: HH:mm:ss or HH:mm:ss.sss",
96
+ });
97
+
98
+ /**
99
+ * Schema for plugin definition
100
+ */
101
+ export const DateTimePluginSchema = z.object({
102
+ name: z.string().min(1, "Plugin name cannot be empty"),
103
+ install: z.function(),
104
+ });
package/src/types.ts ADDED
@@ -0,0 +1,122 @@
1
+ import type { z } from "zod";
2
+ import type { DateTime as DateTimeInstance } from "./core/datetime";
3
+
4
+ /**
5
+ * Time units supported by the library
6
+ */
7
+ export type TimeUnit =
8
+ | "millisecond"
9
+ | "second"
10
+ | "minute"
11
+ | "hour"
12
+ | "day"
13
+ | "week"
14
+ | "month"
15
+ | "year";
16
+
17
+ /**
18
+ * DateTime instance type - re-exported from the class
19
+ */
20
+ export type DateTime = DateTimeInstance;
21
+
22
+ /**
23
+ * Input types that can be converted to DateTime
24
+ */
25
+ export type DateInput = Date | string | number | DateTime;
26
+
27
+ /**
28
+ * DateTime class type (used for plugin typing)
29
+ * Must be defined before DateTimePlugin to avoid forward reference
30
+ */
31
+ export interface DateTimeClass {
32
+ new (input?: DateInput): DateTime;
33
+ prototype: DateTime;
34
+ extend: (plugin: DateTimePlugin, options?: Record<string, unknown>) => void;
35
+ hasPlugin: (name: string) => boolean;
36
+ getPlugin: (name: string) => DateTimePlugin | undefined;
37
+ }
38
+
39
+ /**
40
+ * Plugin definition
41
+ */
42
+ export interface DateTimePlugin {
43
+ /**
44
+ * Plugin name (must be unique)
45
+ */
46
+ name: string;
47
+
48
+ /**
49
+ * Install function that extends the DateTime class
50
+ * @param DateTimeClass - The DateTime class to extend
51
+ * @param options - Optional plugin configuration
52
+ */
53
+ install: (
54
+ DateTimeClass: DateTimeClass,
55
+ options?: Record<string, unknown>,
56
+ ) => void;
57
+ }
58
+
59
+ /**
60
+ * Configuration options for DateTime instance creation
61
+ */
62
+ export interface DateTimeConfig {
63
+ /**
64
+ * Timezone (IANA timezone string, e.g., "America/New_York")
65
+ * Defaults to system timezone
66
+ */
67
+ timezone?: string;
68
+
69
+ /**
70
+ * Locale for formatting (BCP 47 language tag, e.g., "en-US")
71
+ * Defaults to system locale
72
+ */
73
+ locale?: string;
74
+
75
+ /**
76
+ * Whether to use UTC mode
77
+ * @default false
78
+ */
79
+ utc?: boolean;
80
+
81
+ /**
82
+ * Whether parsing should be strict
83
+ * @default true
84
+ */
85
+ strict?: boolean;
86
+ }
87
+
88
+ /**
89
+ * Options for formatting dates
90
+ */
91
+ export interface FormatOptions {
92
+ /**
93
+ * Locale for formatting (BCP 47 language tag)
94
+ */
95
+ locale?: string;
96
+
97
+ /**
98
+ * Timezone for formatting (IANA timezone string)
99
+ */
100
+ timezone?: string;
101
+ }
102
+
103
+ /**
104
+ * Options for parsing dates
105
+ */
106
+ export interface ParseOptions {
107
+ /**
108
+ * Whether to use strict parsing
109
+ * @default true
110
+ */
111
+ strict?: boolean;
112
+
113
+ /**
114
+ * Expected format string
115
+ */
116
+ format?: string;
117
+
118
+ /**
119
+ * Timezone to parse in (IANA timezone string)
120
+ */
121
+ timezone?: string;
122
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowImportingTsExtensions": true,
4
+ "declaration": true,
5
+ "isolatedDeclarations": false,
6
+ "module": "Preserve",
7
+ "moduleDetection": "force",
8
+ "moduleResolution": "bundler",
9
+ "noEmit": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "noImplicitOverride": true,
12
+ "noPropertyAccessFromIndexSignature": false,
13
+ "noUncheckedIndexedAccess": true,
14
+ "noUnusedLocals": false,
15
+ "noUnusedParameters": false,
16
+ "skipLibCheck": true,
17
+ "strict": true,
18
+ "target": "ES2023",
19
+ "verbatimModuleSyntax": true
20
+ },
21
+ "exclude": [
22
+ "node_modules",
23
+ "dist",
24
+ "bunup.config.ts"
25
+ ],
26
+ "include": [
27
+ "src/**/*"
28
+ ]
29
+ }