@omnifyjp/ts 6.3.5 → 6.3.7
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.
- package/dist/php/type-mapper.js +13 -1
- package/package.json +1 -1
package/dist/php/type-mapper.js
CHANGED
|
@@ -128,9 +128,21 @@ export function toStoreRules(property, tableName, fkRuleType = 'integer') {
|
|
|
128
128
|
case 'Date':
|
|
129
129
|
case 'DateTime':
|
|
130
130
|
case 'Timestamp':
|
|
131
|
-
case 'Time':
|
|
132
131
|
rules.push('date');
|
|
133
132
|
break;
|
|
133
|
+
case 'Time':
|
|
134
|
+
// #181: NOT `date`. Laravel's `date` rule runs `strtotime()` and then
|
|
135
|
+
// rejects anything that did not carry a date, so every time-only value a
|
|
136
|
+
// `time` column exists to hold — "12:00", "12:00:00", "23:59:59" — fails
|
|
137
|
+
// it, and only `null` gets through. A form with a time field it is
|
|
138
|
+
// impossible to fill, and nothing red anywhere: the migration, the model,
|
|
139
|
+
// the cast and the TypeScript were all correct.
|
|
140
|
+
//
|
|
141
|
+
// Both formats, because a client that reads a value and sends it back
|
|
142
|
+
// must be accepted: MySQL returns `H:i:s`, while an `<input type="time">`
|
|
143
|
+
// submits `H:i`.
|
|
144
|
+
rules.push('date_format:H:i,H:i:s');
|
|
145
|
+
break;
|
|
134
146
|
case 'Json':
|
|
135
147
|
rules.push('array');
|
|
136
148
|
break;
|