@cedarjs/cli 7.0.0-canary.3227 → 7.0.0-canary.3229

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.
@@ -12,16 +12,35 @@ import {
12
12
 
13
13
  <% if (fieldsToImport.includes('DatetimeLocalField')) { %>
14
14
  /**
15
- * Formats a DateTime string from the API for use as the value of a
16
- * `datetime-local` input, which takes `YYYY-MM-DDTHH:mm`, with no seconds,
17
- * milliseconds or timezone
15
+ * Formats a DateTime string from the API, which is a UTC timestamp, for use as
16
+ * the value of a `datetime-local` input. The input takes `YYYY-MM-DDTHH:mm` in
17
+ * the user's local time, with no seconds, milliseconds or timezone, and the
18
+ * form reads its value back as local time when it is submitted.
18
19
  */
19
20
  function formatDatetime(value: string | undefined | null) {
20
- if (value) {
21
- return value.replace(/:\d{2}\.\d{3}\w/, '')
21
+ if (!value) {
22
+ return undefined
22
23
  }
23
24
 
24
- return undefined
25
+ const date = new Date(value)
26
+
27
+ if (Number.isNaN(date.getTime())) {
28
+ return undefined
29
+ }
30
+
31
+ const pad = (n: number) => String(n).padStart(2, '0')
32
+
33
+ return (
34
+ date.getFullYear() +
35
+ '-' +
36
+ pad(date.getMonth() + 1) +
37
+ '-' +
38
+ pad(date.getDate()) +
39
+ 'T' +
40
+ pad(date.getHours()) +
41
+ ':' +
42
+ pad(date.getMinutes())
43
+ )
25
44
  }
26
45
  <% } %>
27
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "7.0.0-canary.3227",
3
+ "version": "7.0.0-canary.3229",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.8",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "7.0.0-canary.3227",
40
- "@cedarjs/babel-config": "7.0.0-canary.3227",
41
- "@cedarjs/cli-helpers": "7.0.0-canary.3227",
42
- "@cedarjs/internal": "7.0.0-canary.3227",
43
- "@cedarjs/prerender": "7.0.0-canary.3227",
44
- "@cedarjs/project-config": "7.0.0-canary.3227",
45
- "@cedarjs/structure": "7.0.0-canary.3227",
46
- "@cedarjs/telemetry": "7.0.0-canary.3227",
47
- "@cedarjs/utils": "7.0.0-canary.3227",
48
- "@cedarjs/vite": "7.0.0-canary.3227",
49
- "@cedarjs/web-server": "7.0.0-canary.3227",
39
+ "@cedarjs/api-server": "7.0.0-canary.3229",
40
+ "@cedarjs/babel-config": "7.0.0-canary.3229",
41
+ "@cedarjs/cli-helpers": "7.0.0-canary.3229",
42
+ "@cedarjs/internal": "7.0.0-canary.3229",
43
+ "@cedarjs/prerender": "7.0.0-canary.3229",
44
+ "@cedarjs/project-config": "7.0.0-canary.3229",
45
+ "@cedarjs/structure": "7.0.0-canary.3229",
46
+ "@cedarjs/telemetry": "7.0.0-canary.3229",
47
+ "@cedarjs/utils": "7.0.0-canary.3229",
48
+ "@cedarjs/vite": "7.0.0-canary.3229",
49
+ "@cedarjs/web-server": "7.0.0-canary.3229",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.2",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "2.11.0",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "7.0.0-canary.3227",
97
+ "@cedarjs/framework-tools": "7.0.0-canary.3229",
98
98
  "@prisma/dmmf": "7.10.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.78.1",