mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Update type definitions with changes from Luxon 1.13 to 1.15 (#35760)
* Added changes from Luxon 1.14 and 1.15 * Removed patch version from header * Added new definition author
This commit is contained in:
committed by
Sheetal Nandi
parent
b22b47cf53
commit
6cda797334
Vendored
+5
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for luxon 1.13
|
||||
// Type definitions for luxon 1.15
|
||||
// Project: https://github.com/moment/luxon#readme
|
||||
// Definitions by: Colby DeHart <https://github.com/colbydehart>
|
||||
// Hyeonseok Yang <https://github.com/FourwingsY>
|
||||
@@ -7,6 +7,7 @@
|
||||
// Pietro Vismara <https://github.com/pietrovismara>
|
||||
// Janeene Beeforth <https://github.com/dawnmist>
|
||||
// Jason Yu <https://github.com/ycmjason>
|
||||
// Miklos Danka <https://github.com/mdanka>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -496,8 +497,11 @@ export interface ZoneOffsetOptions {
|
||||
localeCode?: string;
|
||||
}
|
||||
|
||||
export type ZoneOffsetFormat = 'narrow' | 'short' | 'techie';
|
||||
|
||||
export class Zone {
|
||||
offsetName(ts: number, options?: ZoneOffsetOptions): string;
|
||||
formatOffset(ts: number, format: ZoneOffsetFormat): string;
|
||||
isValid: boolean;
|
||||
name: string;
|
||||
type: string;
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
IANAZone,
|
||||
Zone,
|
||||
ZoneOffsetOptions,
|
||||
ZoneOffsetFormat,
|
||||
} from 'luxon';
|
||||
|
||||
/* DateTime */
|
||||
@@ -26,10 +27,13 @@ const fromObject = DateTime.fromObject({
|
||||
});
|
||||
|
||||
const ianaZone = new IANAZone('America/Los_Angeles');
|
||||
IANAZone.create("Europe/London");
|
||||
const testIanaZone = IANAZone.create("Europe/London");
|
||||
IANAZone.isValidSpecifier("Europe/London");
|
||||
IANAZone.isValidZone("Europe/London");
|
||||
IANAZone.resetCache();
|
||||
testIanaZone.formatOffset(dt.toMillis(), 'narrow'); // => +1
|
||||
testIanaZone.formatOffset(dt.toMillis(), 'short'); // => +01:00
|
||||
testIanaZone.formatOffset(dt.toMillis(), 'techie'); // => +0100
|
||||
const ianaZoneTest = DateTime.fromObject({
|
||||
zone: ianaZone,
|
||||
});
|
||||
@@ -328,6 +332,9 @@ class SampleZone extends Zone {
|
||||
offsetName(ts: number, options?: ZoneOffsetOptions) {
|
||||
return 'SampleZone';
|
||||
}
|
||||
formatOffset(ts: number, format: ZoneOffsetFormat) {
|
||||
return '+6';
|
||||
}
|
||||
equals(other: Zone) {
|
||||
return other.name === this.name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user