@f-o-t/datetime 0.1.1 → 0.1.5

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.
Files changed (47) hide show
  1. package/dist/core/datetime.d.ts +341 -0
  2. package/dist/core/datetime.d.ts.map +1 -0
  3. package/dist/core/factory.d.ts +30 -0
  4. package/dist/core/factory.d.ts.map +1 -0
  5. package/dist/errors.d.ts +43 -0
  6. package/dist/errors.d.ts.map +1 -0
  7. package/dist/index-77f5wgyc.js +41 -0
  8. package/dist/index-77f5wgyc.js.map +10 -0
  9. package/dist/index-9jdtsp4s.js +55 -0
  10. package/dist/index-9jdtsp4s.js.map +10 -0
  11. package/dist/index-a78jd9k6.js +64 -0
  12. package/dist/index-a78jd9k6.js.map +10 -0
  13. package/dist/index-rtm7bpky.js +86 -0
  14. package/dist/index-rtm7bpky.js.map +10 -0
  15. package/dist/index-v3cytzbp.js +105 -0
  16. package/dist/index-v3cytzbp.js.map +11 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +390 -0
  20. package/dist/index.js.map +13 -0
  21. package/dist/plugins/business-days/index.d.ts +45 -0
  22. package/dist/plugins/business-days/index.d.ts.map +1 -0
  23. package/dist/plugins/business-days/index.js +10 -0
  24. package/dist/plugins/business-days/index.js.map +9 -0
  25. package/dist/plugins/format/index.d.ts +54 -0
  26. package/dist/plugins/format/index.d.ts.map +1 -0
  27. package/dist/plugins/format/index.js +10 -0
  28. package/dist/plugins/format/index.js.map +9 -0
  29. package/dist/plugins/format/tokens.d.ts +20 -0
  30. package/dist/plugins/format/tokens.d.ts.map +1 -0
  31. package/dist/plugins/index.d.ts +14 -0
  32. package/dist/plugins/index.d.ts.map +1 -0
  33. package/dist/plugins/plugin-base.d.ts +49 -0
  34. package/dist/plugins/plugin-base.d.ts.map +1 -0
  35. package/dist/plugins/relative-time/index.d.ts +61 -0
  36. package/dist/plugins/relative-time/index.d.ts.map +1 -0
  37. package/dist/plugins/relative-time/index.js +10 -0
  38. package/dist/plugins/relative-time/index.js.map +9 -0
  39. package/dist/plugins/timezone/index.d.ts +59 -0
  40. package/dist/plugins/timezone/index.d.ts.map +1 -0
  41. package/dist/plugins/timezone/index.js +10 -0
  42. package/dist/plugins/timezone/index.js.map +9 -0
  43. package/dist/schemas.d.ts +66 -0
  44. package/dist/schemas.d.ts.map +1 -0
  45. package/dist/types.d.ts +96 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/package.json +50 -49
@@ -0,0 +1,96 @@
1
+ import type { DateTime as DateTimeInstance } from "./core/datetime";
2
+ /**
3
+ * Time units supported by the library
4
+ */
5
+ export type TimeUnit = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year";
6
+ /**
7
+ * DateTime instance type - re-exported from the class
8
+ */
9
+ export type DateTime = DateTimeInstance;
10
+ /**
11
+ * Input types that can be converted to DateTime
12
+ */
13
+ export type DateInput = Date | string | number | DateTime;
14
+ /**
15
+ * DateTime class type (used for plugin typing)
16
+ * Must be defined before DateTimePlugin to avoid forward reference
17
+ */
18
+ export interface DateTimeClass {
19
+ new (input?: DateInput): DateTime;
20
+ prototype: DateTime;
21
+ extend: (plugin: DateTimePlugin, options?: Record<string, unknown>) => void;
22
+ hasPlugin: (name: string) => boolean;
23
+ getPlugin: (name: string) => DateTimePlugin | undefined;
24
+ }
25
+ /**
26
+ * Plugin definition
27
+ */
28
+ export interface DateTimePlugin {
29
+ /**
30
+ * Plugin name (must be unique)
31
+ */
32
+ name: string;
33
+ /**
34
+ * Install function that extends the DateTime class
35
+ * @param DateTimeClass - The DateTime class to extend
36
+ * @param options - Optional plugin configuration
37
+ */
38
+ install: (DateTimeClass: DateTimeClass, options?: Record<string, unknown>) => void;
39
+ }
40
+ /**
41
+ * Configuration options for DateTime instance creation
42
+ */
43
+ export interface DateTimeConfig {
44
+ /**
45
+ * Timezone (IANA timezone string, e.g., "America/New_York")
46
+ * Defaults to system timezone
47
+ */
48
+ timezone?: string;
49
+ /**
50
+ * Locale for formatting (BCP 47 language tag, e.g., "en-US")
51
+ * Defaults to system locale
52
+ */
53
+ locale?: string;
54
+ /**
55
+ * Whether to use UTC mode
56
+ * @default false
57
+ */
58
+ utc?: boolean;
59
+ /**
60
+ * Whether parsing should be strict
61
+ * @default true
62
+ */
63
+ strict?: boolean;
64
+ }
65
+ /**
66
+ * Options for formatting dates
67
+ */
68
+ export interface FormatOptions {
69
+ /**
70
+ * Locale for formatting (BCP 47 language tag)
71
+ */
72
+ locale?: string;
73
+ /**
74
+ * Timezone for formatting (IANA timezone string)
75
+ */
76
+ timezone?: string;
77
+ }
78
+ /**
79
+ * Options for parsing dates
80
+ */
81
+ export interface ParseOptions {
82
+ /**
83
+ * Whether to use strict parsing
84
+ * @default true
85
+ */
86
+ strict?: boolean;
87
+ /**
88
+ * Expected format string
89
+ */
90
+ format?: string;
91
+ /**
92
+ * Timezone to parse in (IANA timezone string)
93
+ */
94
+ timezone?: string;
95
+ }
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,QAAQ,GACf,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC3B,KAAK,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,SAAS,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5E,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,OAAO,EAAE,CACN,aAAa,EAAE,aAAa,EAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,51 +1,52 @@
1
1
  {
2
- "name": "@f-o-t/datetime",
3
- "version": "0.1.1",
4
- "type": "module",
5
- "files": [
6
- "dist"
7
- ],
8
- "main": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- },
15
- "./plugins/timezone": {
16
- "types": "./dist/plugins/timezone/index.d.ts",
17
- "default": "./dist/plugins/timezone/index.js"
18
- },
19
- "./plugins/business-days": {
20
- "types": "./dist/plugins/business-days/index.d.ts",
21
- "default": "./dist/plugins/business-days/index.js"
22
- },
23
- "./plugins/format": {
24
- "types": "./dist/plugins/format/index.d.ts",
25
- "default": "./dist/plugins/format/index.js"
26
- },
27
- "./plugins/relative-time": {
28
- "types": "./dist/plugins/relative-time/index.d.ts",
29
- "default": "./dist/plugins/relative-time/index.js"
30
- }
31
- },
32
- "scripts": {
33
- "build": "bun x --bun fot build",
34
- "test": "bun x --bun fot test",
35
- "lint": "bun x --bun fot lint",
36
- "format": "bun x --bun fot format",
37
- "typecheck": "bun x --bun fot typecheck"
38
- },
39
- "dependencies": {
40
- "zod": "^4.3.6"
41
- },
42
- "devDependencies": {
43
- "@f-o-t/cli": "^1.0.0",
44
- "@f-o-t/config": "^1.0.0"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "https://github.com/F-O-T/libraries.git",
49
- "directory": "libraries/datetime"
50
- }
2
+ "name": "@f-o-t/datetime",
3
+ "version": "0.1.5",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./plugins/timezone": {
16
+ "types": "./dist/plugins/timezone/index.d.ts",
17
+ "default": "./dist/plugins/timezone/index.js"
18
+ },
19
+ "./plugins/business-days": {
20
+ "types": "./dist/plugins/business-days/index.d.ts",
21
+ "default": "./dist/plugins/business-days/index.js"
22
+ },
23
+ "./plugins/format": {
24
+ "types": "./dist/plugins/format/index.d.ts",
25
+ "default": "./dist/plugins/format/index.js"
26
+ },
27
+ "./plugins/relative-time": {
28
+ "types": "./dist/plugins/relative-time/index.d.ts",
29
+ "default": "./dist/plugins/relative-time/index.js"
30
+ }
31
+ },
32
+ "scripts": {
33
+ "build": "bun x --bun fot build",
34
+ "test": "bun x --bun fot test",
35
+ "lint": "bun x --bun fot lint",
36
+ "format": "bun x --bun fot format",
37
+ "typecheck": "bun x --bun fot typecheck"
38
+ },
39
+ "dependencies": {
40
+ "zod": "^4.3.6"
41
+ },
42
+ "devDependencies": {
43
+ "@f-o-t/cli": "^1.0.1",
44
+ "@f-o-t/config": "^1.0.3",
45
+ "@types/bun": "latest"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/F-O-T/libraries.git",
50
+ "directory": "libraries/datetime"
51
+ }
51
52
  }