Merge pull request #32164 from pietrovismara/master

[Luxon] Added DateTime.zone and Interval.mapEndpoints definitions
This commit is contained in:
Benjamin Lichtman
2019-01-22 09:41:50 -08:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -1,9 +1,10 @@
// Type definitions for luxon 1.4
// Type definitions for luxon 1.10
// Project: https://github.com/moment/luxon#readme
// Definitions by: Colby DeHart <https://github.com/colbydehart>
// Hyeonseok Yang <https://github.com/FourwingsY>
// Jonathan Siebern <https://github.com/jsiebern>
// Matt R. Wilson <https://github.com/mastermatt>
// Pietro Vismara <https://github.com/pietrovismara>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -225,6 +226,7 @@ declare module 'luxon' {
weeksInWeekYear: number;
year: number;
zoneName: string;
zone: Zone;
diff(
other: DateTime,
unit?: DurationUnit | DurationUnit[],
@@ -424,6 +426,7 @@ declare module 'luxon' {
toISO(options?: ISOTimeOptions): string;
toString(): string;
union(other: Interval): Interval;
mapEndpoints(cb: (d: DateTime) => DateTime): Interval;
}
namespace Settings {
+3
View File
@@ -71,6 +71,8 @@ dt.plus({ hours: 3, minutes: 2 });
dt.minus({ days: 7 });
dt.startOf('day');
dt.endOf('hour');
dt.zone;
dt.zoneName;
dt.set({ hour: 3 }).hour;
@@ -109,6 +111,7 @@ i.length();
i.length('years');
i.contains(DateTime.local(2019));
i.set({end: DateTime.local(2020)});
i.mapEndpoints((d) => d);
i.toISO();
i.toString();