@spytecgps/lambda-utils 1.0.12 → 1.0.13

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.
@@ -113,9 +113,15 @@ exports.SpytecJoi = Joi.extend(function (joi) { return ({
113
113
  }); }, function (joi) { return ({
114
114
  type: 'date',
115
115
  base: joi.date(),
116
- prepare: function (value) {
117
- return {
118
- value: dayjs_1.default.tz(value, 'UTC').toDate(),
119
- };
116
+ prepare: function (value, helpers) {
117
+ try {
118
+ var dayjsDate = dayjs_1.default.tz(value, 'UTC');
119
+ if (dayjsDate.isValid()) {
120
+ return { value: dayjsDate.toDate() };
121
+ }
122
+ }
123
+ catch (error) {
124
+ return helpers.error('any.invalid');
125
+ }
120
126
  },
121
127
  }); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/lambda-utils",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Lambda Utils",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",