@propriety/court-calendar 0.0.13 → 0.0.15

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.
@@ -7,6 +7,34 @@ export function formatDateForAPI(date: Date): string {
7
7
  return `${year}-${month}-${day}`;
8
8
  }
9
9
 
10
+ export function formatDateTimeForAPI(date: Date, hearingTime?: string): string {
11
+ const datePart = formatDateForAPI(date);
12
+ if (hearingTime) {
13
+ const time24 = to24Hour(hearingTime);
14
+ return `${datePart} ${time24}:00`;
15
+ }
16
+ return datePart;
17
+ }
18
+
19
+ function to24Hour(time: string): string {
20
+ // Already in HH:mm format (24-hour)
21
+ if (/^\d{1,2}:\d{2}$/.test(time.trim())) {
22
+ const [h, m] = time.trim().split(':');
23
+ return `${h.padStart(2, '0')}:${m}`;
24
+ }
25
+ // 12-hour format like "10:00 AM" or "2:30 PM"
26
+ const match = time.trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
27
+ if (match) {
28
+ let hours = parseInt(match[1], 10);
29
+ const minutes = match[2];
30
+ const period = match[3].toUpperCase();
31
+ if (period === 'AM' && hours === 12) hours = 0;
32
+ if (period === 'PM' && hours !== 12) hours += 12;
33
+ return `${String(hours).padStart(2, '0')}:${minutes}`;
34
+ }
35
+ return time;
36
+ }
37
+
10
38
  // [\"Sales\"] -> Sales
11
39
  export function formatEvidence(evidence: Evidence): string {
12
40
  if (!evidence || !evidence.Evidence) return '';
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- // export stuff
2
- export { default as CCalendar } from './_components/CCalendar';
1
+ // export stuff
2
+ export { default as CCalendar } from './_components/CCalendar';
package/tsconfig.app.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2022",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
- "types": ["vite/client"],
9
- "skipLibCheck": true,
10
- "baseUrl": ".",
11
- "paths": {
12
- "@/*": ["./src/*"]
13
- },
14
-
15
- /* Bundler mode */
16
- "moduleResolution": "bundler",
17
- "allowImportingTsExtensions": true,
18
- "verbatimModuleSyntax": true,
19
- "moduleDetection": "force",
20
- "noEmit": true,
21
- "jsx": "react-jsx",
22
-
23
- /* Linting */
24
- "strict": true,
25
- "noUnusedLocals": true,
26
- "noUnusedParameters": true,
27
- "erasableSyntaxOnly": false,
28
- "noFallthroughCasesInSwitch": true,
29
- "noUncheckedSideEffectImports": true
30
- },
31
- "include": ["src", "dev/main.tsx"]
32
- }
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2022",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "types": ["vite/client"],
9
+ "skipLibCheck": true,
10
+ "baseUrl": ".",
11
+ "paths": {
12
+ "@/*": ["./src/*"]
13
+ },
14
+
15
+ /* Bundler mode */
16
+ "moduleResolution": "bundler",
17
+ "allowImportingTsExtensions": true,
18
+ "verbatimModuleSyntax": true,
19
+ "moduleDetection": "force",
20
+ "noEmit": true,
21
+ "jsx": "react-jsx",
22
+
23
+ /* Linting */
24
+ "strict": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "erasableSyntaxOnly": false,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "noUncheckedSideEffectImports": true
30
+ },
31
+ "include": ["src", "dev/main.tsx"]
32
+ }
package/tsconfig.json CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "files": [],
3
- "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
4
- }
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
4
+ }
@@ -1,30 +1,30 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "types": ["node"],
8
- "skipLibCheck": true,
9
- "baseUrl": ".",
10
- "paths": {
11
- "@/*": ["./src/*"]
12
- },
13
-
14
- /* Bundler mode */
15
- "moduleResolution": "bundler",
16
- "allowImportingTsExtensions": true,
17
- "verbatimModuleSyntax": true,
18
- "moduleDetection": "force",
19
- "noEmit": true,
20
-
21
- /* Linting */
22
- "strict": true,
23
- "noUnusedLocals": true,
24
- "noUnusedParameters": true,
25
- "erasableSyntaxOnly": false,
26
- "noFallthroughCasesInSwitch": true,
27
- "noUncheckedSideEffectImports": true
28
- },
29
- "include": ["vite.config.ts"]
30
- }
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+ "baseUrl": ".",
10
+ "paths": {
11
+ "@/*": ["./src/*"]
12
+ },
13
+
14
+ /* Bundler mode */
15
+ "moduleResolution": "bundler",
16
+ "allowImportingTsExtensions": true,
17
+ "verbatimModuleSyntax": true,
18
+ "moduleDetection": "force",
19
+ "noEmit": true,
20
+
21
+ /* Linting */
22
+ "strict": true,
23
+ "noUnusedLocals": true,
24
+ "noUnusedParameters": true,
25
+ "erasableSyntaxOnly": false,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noUncheckedSideEffectImports": true
28
+ },
29
+ "include": ["vite.config.ts"]
30
+ }