@finnair/v-validation-luxon 1.1.0-alpha.8 → 1.1.0-alpha.9

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.1.0-alpha.9](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.8...v1.1.0-alpha.9) (2022-08-19)
7
+
8
+ **Note:** Version bump only for package @finnair/v-validation-luxon
9
+
10
+
11
+
12
+
13
+
6
14
  # [1.1.0-alpha.8](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2022-08-19)
7
15
 
8
16
  **Note:** Version bump only for package @finnair/v-validation-luxon
package/dist/Vluxon.d.ts CHANGED
@@ -10,7 +10,7 @@ export interface ValidateLuxonParams {
10
10
  type: string;
11
11
  proto: any;
12
12
  pattern: RegExp;
13
- parser: (value: string) => DateTime;
13
+ parser: (value: string, match: RegExpExecArray) => DateTime;
14
14
  }
15
15
  export declare function validateLuxon({ value, path, ctx, type, proto, pattern, parser }: ValidateLuxonParams): Promise<ValidationResult>;
16
16
  export declare class DurationValidator extends Validator {
package/dist/Vluxon.js CHANGED
@@ -27,8 +27,9 @@ function validateLuxon({ value, path, ctx, type, proto, pattern, parser }) {
27
27
  }
28
28
  }
29
29
  else if ((0, v_validation_1.isString)(value)) {
30
- if (pattern.test(value)) {
31
- const dateTime = parser(value);
30
+ const match = pattern.exec(value);
31
+ if (match) {
32
+ const dateTime = parser(value, match);
32
33
  if (dateTime.isValid) {
33
34
  return ctx.success(new proto(dateTime));
34
35
  }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const luxon_1 = require("luxon");
4
- console.log(luxon_1.DateTime.fromFormat('20220819095432+0', 'yyyyMMddHHmmssZ').toJSON());
4
+ console.log(luxon_1.DateTime.fromFormat('2022-08-19+0', 'yyyy-MM-ddZ').toJSON());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finnair/v-validation-luxon",
3
- "version": "1.1.0-alpha.8",
3
+ "version": "1.1.0-alpha.9",
4
4
  "private": false,
5
5
  "description": "Luxon validators",
6
6
  "main": "dist/index.js",
@@ -32,5 +32,5 @@
32
32
  "devDependencies": {
33
33
  "@types/luxon": "3.0.0"
34
34
  },
35
- "gitHead": "883052983f33664439c1baae629ed5f6d53cbdcb"
35
+ "gitHead": "dcae3dd01e676de15d600898de5188c8384cb360"
36
36
  }