@bedrockio/model 0.1.30 → 0.1.31
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/cjs/schema.js +5 -1
- package/package.json +1 -1
- package/src/schema.js +5 -1
package/dist/cjs/schema.js
CHANGED
|
@@ -258,7 +258,11 @@ function applyDateExtension(typedef) {
|
|
|
258
258
|
default: defaultValue
|
|
259
259
|
} = typedef;
|
|
260
260
|
if (type === 'Date' && defaultValue === 'now') {
|
|
261
|
-
|
|
261
|
+
// Allow mocking which would modify the global
|
|
262
|
+
// Date after the schema has been set up.
|
|
263
|
+
typedef.default = () => {
|
|
264
|
+
return Date.now();
|
|
265
|
+
};
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
|
package/package.json
CHANGED
package/src/schema.js
CHANGED
|
@@ -262,7 +262,11 @@ function applyTupleExtension(typedef) {
|
|
|
262
262
|
function applyDateExtension(typedef) {
|
|
263
263
|
const { type, default: defaultValue } = typedef;
|
|
264
264
|
if (type === 'Date' && defaultValue === 'now') {
|
|
265
|
-
|
|
265
|
+
// Allow mocking which would modify the global
|
|
266
|
+
// Date after the schema has been set up.
|
|
267
|
+
typedef.default = () => {
|
|
268
|
+
return Date.now();
|
|
269
|
+
};
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
|