Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@finnair/v-validation-luxon

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finnair/v-validation-luxon - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

120

CHANGELOG.md

@@ -6,16 +6,8 @@ # Change Log

# [3.0.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0) (2022-10-03)
# [3.1.0](https://github.com/finnair/v-validation/compare/v3.0.0...v3.1.0) (2022-10-24)
**Note:** Version bump only for package @finnair/v-validation-luxon
# [3.0.0-alpha.2](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.2) (2022-09-28)
### Features
* Use SyncPromise also in schema and luxon ([792fbb4](https://github.com/finnair/v-validation/commit/792fbb4c78d07ea085d669312fef5e44e7a397fd))
* LocalDateTimeLuxon (a date-time without timezone) ([#83](https://github.com/finnair/v-validation/issues/83)) ([1517c6e](https://github.com/finnair/v-validation/commit/1517c6ec8af835cb928cd6cf228b9bdc9f0cda3e))

@@ -26,57 +18,34 @@

# [3.0.0-alpha.1](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.1) (2022-09-26)
# [3.0.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0) (2022-10-03)
### Features
* Use SyncPromise also in schema and luxon ([792fbb4](https://github.com/finnair/v-validation/commit/792fbb4c78d07ea085d669312fef5e44e7a397fd))
- Optimize performance.
- Use Object.freeze to ensure Validator immutability.
### BREAKING CHANGES
- LuxonValidator class instead of validateLuxon function.
# [3.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.0) (2022-09-26)
### Features
* Use SyncPromise also in schema and luxon ([e8590b8](https://github.com/finnair/v-validation/commit/e8590b8c2a44ad28fde88f8682f53628ecf74a0f))
# [2.0.0](https://github.com/finnair/v-validation/compare/v1.1.0...v2.0.0) (2022-09-08)
- Upgrade All Dependencies (#80) ([fb6309c](https://github.com/finnair/v-validation/commit/fb6309cc1d9fd90f3e8c5ba79798fae1450b66a6)), closes [#80](https://github.com/finnair/v-validation/issues/80)
* Upgrade All Dependencies (#80) ([fb6309c](https://github.com/finnair/v-validation/commit/fb6309cc1d9fd90f3e8c5ba79798fae1450b66a6)), closes [#80](https://github.com/finnair/v-validation/issues/80)
### Features
* Implement toString in Luxon wrapper types ([#79](https://github.com/finnair/v-validation/issues/79)) ([3f3f3e8](https://github.com/finnair/v-validation/commit/3f3f3e8a4172c7803a7be4809f06aba554f7090f))
- Implement toString in Luxon wrapper types ([#79](https://github.com/finnair/v-validation/issues/79)) ([3f3f3e8](https://github.com/finnair/v-validation/commit/3f3f3e8a4172c7803a7be4809f06aba554f7090f))
### BREAKING CHANGES
* Drop Node 12 support
* Add .nvmrc
* Introduce CI build for Node 18
* Upgrade All Dependencies
- Drop Node 12 support
- Add .nvmrc
- Introduce CI build for Node 18
- Upgrade All Dependencies
# [1.1.0](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0) (2022-08-29)
### Features
* Support for Luxon ([94b3806](https://github.com/finnair/v-validation/commit/94b38060e07feeb0abb8c81659d8bda537a4d9aa))
- Support for Luxon ([94b3806](https://github.com/finnair/v-validation/commit/94b38060e07feeb0abb8c81659d8bda537a4d9aa))
# [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)

@@ -86,6 +55,2 @@

# [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)

@@ -95,6 +60,2 @@

# [1.1.0-alpha.7](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2022-08-18)

@@ -104,40 +65,24 @@

# [1.1.0-alpha.6](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.6) (2022-08-17)
### Bug Fixes
* Fix exports ([b9eacb6](https://github.com/finnair/v-validation/commit/b9eacb6e98a05a07049eb0a8f97b7e6b4958973a))
- Fix exports ([b9eacb6](https://github.com/finnair/v-validation/commit/b9eacb6e98a05a07049eb0a8f97b7e6b4958973a))
### Features
* fromISO helper for Luxon wrapper construction ([e3b8f24](https://github.com/finnair/v-validation/commit/e3b8f247b3a9bfef8ad474688f995862fdd810e3))
* Support for Luxon ([00d0a8e](https://github.com/finnair/v-validation/commit/00d0a8e8c8de46bfeb3502f51bb8cd5a3627070e))
- fromISO helper for Luxon wrapper construction ([e3b8f24](https://github.com/finnair/v-validation/commit/e3b8f247b3a9bfef8ad474688f995862fdd810e3))
- Support for Luxon ([00d0a8e](https://github.com/finnair/v-validation/commit/00d0a8e8c8de46bfeb3502f51bb8cd5a3627070e))
# [1.1.0-alpha.5](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.5) (2022-08-16)
### Bug Fixes
* Fix exports ([904e63c](https://github.com/finnair/v-validation/commit/904e63c4a40e65d274349ae0f5ea80c697c5c8ce))
- Fix exports ([904e63c](https://github.com/finnair/v-validation/commit/904e63c4a40e65d274349ae0f5ea80c697c5c8ce))
### Features
* fromISO helper for Luxon wrapper construction ([81d5b2e](https://github.com/finnair/v-validation/commit/81d5b2eb08f360ab56ec0c6caece392a0e6eb1a1))
* Support for Luxon ([6a243f0](https://github.com/finnair/v-validation/commit/6a243f043db2ca6700180eb758a08d8edfe1e538))
- fromISO helper for Luxon wrapper construction ([81d5b2e](https://github.com/finnair/v-validation/commit/81d5b2eb08f360ab56ec0c6caece392a0e6eb1a1))
- Support for Luxon ([6a243f0](https://github.com/finnair/v-validation/commit/6a243f043db2ca6700180eb758a08d8edfe1e538))
# [1.1.0-alpha.4](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.3...v1.1.0-alpha.4) (2022-08-15)

@@ -147,6 +92,2 @@

# [1.1.0-alpha.3](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.2...v1.1.0-alpha.3) (2022-08-15)

@@ -156,33 +97,18 @@

# [1.1.0-alpha.2](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2022-08-12)
### Bug Fixes
* Fix exports ([c4c42f7](https://github.com/finnair/v-validation/commit/c4c42f715e8c52b29b76f7f07753f632528a69ab))
- Fix exports ([c4c42f7](https://github.com/finnair/v-validation/commit/c4c42f715e8c52b29b76f7f07753f632528a69ab))
# [1.1.0-alpha.1](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2022-08-12)
### Features
* fromISO helper for Luxon wrapper construction ([187796e](https://github.com/finnair/v-validation/commit/187796e707f44033d94943ef64d48626317b4d80))
- fromISO helper for Luxon wrapper construction ([187796e](https://github.com/finnair/v-validation/commit/187796e707f44033d94943ef64d48626317b4d80))
# [1.1.0-alpha.0](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.0) (2022-08-12)
### Features
* Support for Luxon ([6f982df](https://github.com/finnair/v-validation/commit/6f982df9b55395e953069914c93fef677dec171e))
- Support for Luxon ([6f982df](https://github.com/finnair/v-validation/commit/6f982df9b55395e953069914c93fef677dec171e))

15

dist/luxon.d.ts

@@ -47,2 +47,17 @@ import { DateTime, DateTimeJSOptions, DateTimeOptions, Zone } from 'luxon';

}
export declare class LocalDateTimeLuxon extends LuxonDateTime {
static readonly format = "yyyy-MM-dd'T'HH:mm:ss";
constructor(input: LuxonDateTimeInput);
static nowLocal(options?: DateTimeJSOptions): LocalDateTimeLuxon;
static nowUtc(): LocalDateTimeLuxon;
static fromISO(value: string, options?: DateTimeOptions): LocalDateTimeLuxon;
static fromFormat(value: string, format: string, options?: DateTimeOptions): LocalDateTimeLuxon;
static fromJSDate(date: Date, options?: {
zone?: string | Zone;
}): LocalDateTimeLuxon;
static fromMillis(millis: number, options?: DateTimeJSOptions): LocalDateTimeLuxon;
protected normalize(dateTime: DateTime): DateTime;
wrap(fn: (dateTime: DateTime) => DateTime): LocalDateTimeLuxon;
toJSON(): string;
}
export declare class DateTimeLuxon extends LuxonDateTime {

@@ -49,0 +64,0 @@ static readonly format = "yyyy-MM-dd'T'HH:mm:ss";

"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DateTimeMillisUtcLuxon = exports.DateTimeMillisLuxon = exports.DateTimeUtcLuxon = exports.DateTimeLuxon = exports.LocalTimeLuxon = exports.LocalDateLuxon = exports.LuxonDateTime = void 0;
exports.DateTimeMillisUtcLuxon = exports.DateTimeMillisLuxon = exports.DateTimeUtcLuxon = exports.DateTimeLuxon = exports.LocalDateTimeLuxon = exports.LocalTimeLuxon = exports.LocalDateLuxon = exports.LuxonDateTime = void 0;
const luxon_1 = require("luxon");

@@ -116,2 +116,36 @@ class LuxonDateTime {

LocalTimeLuxon.format = 'HH:mm:ss';
class LocalDateTimeLuxon extends LuxonDateTime {
constructor(input) {
super(input);
}
static nowLocal(options) {
return new LocalDateTimeLuxon(luxon_1.DateTime.local(options));
}
static nowUtc() {
return new LocalDateTimeLuxon(luxon_1.DateTime.utc());
}
static fromISO(value, options) {
return new LocalDateTimeLuxon(luxon_1.DateTime.fromISO(value, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
}
static fromFormat(value, format, options) {
return new LocalDateTimeLuxon(luxon_1.DateTime.fromFormat(value, format, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
}
static fromJSDate(date, options) {
return new LocalDateTimeLuxon(luxon_1.DateTime.fromJSDate(date, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
}
static fromMillis(millis, options) {
return new LocalDateTimeLuxon(luxon_1.DateTime.fromMillis(millis, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
}
normalize(dateTime) {
return luxon_1.DateTime.utc(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute, dateTime.second);
}
wrap(fn) {
return new LocalDateTimeLuxon(fn(this.dateTime));
}
toJSON() {
return this.dateTime.toFormat(LocalDateTimeLuxon.format);
}
}
exports.LocalDateTimeLuxon = LocalDateTimeLuxon;
LocalDateTimeLuxon.format = "yyyy-MM-dd'T'HH:mm:ss";
class DateTimeLuxon extends LuxonDateTime {

@@ -118,0 +152,0 @@ constructor(input) {

"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
const luxon_1 = require("luxon");
console.log(luxon_1.DateTime.fromMillis(luxon_1.DateTime.fromISO('2022-08-30T23:00:00Z').toMillis(), { zone: luxon_1.FixedOffsetZone.instance(180) }).toJSON());
let o = { foo: 1 };
console.log((_b = (_a = o.foo) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'not found');
const dt = luxon_1.DateTime.fromISO('2022-10-29T23:30:00').setZone(luxon_1.FixedOffsetZone.instance(-60), { keepLocalTime: true });
console.log(dt);
console.log(dt.setZone(luxon_1.FixedOffsetZone.utcInstance));

@@ -19,2 +19,3 @@ import { ValidationContext, Validator, ValidationResult } from '@finnair/v-validation';

declare function localTime(options?: DateTimeOptions): LuxonValidator;
declare function localDateTime(options?: DateTimeOptions): LuxonValidator;
declare function dateTime(options?: DateTimeOptions): LuxonValidator;

@@ -44,2 +45,3 @@ declare function dateTimeUtc(options?: DateTimeOptions): LuxonValidator;

localTime: typeof localTime;
localDateTime: typeof localDateTime;
dateTime: typeof dateTime;

@@ -46,0 +48,0 @@ dateTimeUtc: typeof dateTimeUtc;

@@ -70,3 +70,12 @@ "use strict";

}
const dateTimePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}(?::?\d{2})?)$/;
const localDateTimePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/;
function localDateTime(options = { zone: luxon_1.FixedOffsetZone.utcInstance }) {
return new LuxonValidator({
type: 'DateTime',
proto: luxon_2.LocalDateTimeLuxon,
pattern: localDateTimePattern,
parser: (value) => luxon_1.DateTime.fromISO(value, options),
});
}
const dateTimeTzPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}(?::?\d{2})?)$/;
function dateTime(options = { setZone: true }) {

@@ -76,3 +85,3 @@ return new LuxonValidator({

proto: luxon_2.DateTimeLuxon,
pattern: dateTimePattern,
pattern: dateTimeTzPattern,
parser: (value) => luxon_1.DateTime.fromISO(value, options),

@@ -85,3 +94,3 @@ });

proto: luxon_2.DateTimeUtcLuxon,
pattern: dateTimePattern,
pattern: dateTimeTzPattern,
parser: (value) => luxon_1.DateTime.fromISO(value, options),

@@ -198,2 +207,3 @@ });

localTime,
localDateTime,
dateTime,

@@ -200,0 +210,0 @@ dateTimeUtc,

{
"name": "@finnair/v-validation-luxon",
"version": "3.0.0",
"version": "3.1.0",
"private": false,

@@ -28,4 +28,4 @@ "description": "Luxon validators",

"dependencies": {
"@finnair/path": "^3.0.0",
"@finnair/v-validation": "^3.0.0"
"@finnair/path": "^3.1.0",
"@finnair/v-validation": "^3.1.0"
},

@@ -35,3 +35,3 @@ "peerDependencies": {

},
"gitHead": "597b85f1fcef99722bccf47c6d30260973d6d88c"
"gitHead": "5182a63fa61cc1f5c8991e1482c5bbffe14798c3"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc