From ae52a5d2f03119bf76c0ac4726fb4028f85f9004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82a=C5=BCejewicz?= Date: Sat, 31 Oct 2020 22:38:59 +0100 Subject: [PATCH] fix(luxon): Settings.defaultZone setter This add support for 'setter' for Settings.defaultZone, The implementation reason is described here: https://github.com/moment/luxon/pull/548#issuecomment-528789106 https://github.com/moment/luxon/blob/master/src/settings.js#L49 Thanks! --- types/luxon/index.d.ts | 2 +- types/luxon/luxon-tests.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 2582ecba4bda99..493be7c15f4bc7 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -522,7 +522,7 @@ export namespace Settings { let defaultLocale: string; let defaultNumberingSystem: string; let defaultOutputCalendar: string; - const defaultZone: Zone; + let defaultZone: Zone; let defaultZoneName: string; let throwOnInvalid: boolean; function now(): number; diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 41c3f1ccd16bce..787f079c9066c4 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -206,14 +206,13 @@ Info.features().relative; Settings.defaultLocale; Settings.defaultLocale = 'en'; Settings.defaultZoneName = 'Europe/Paris'; +Settings.defaultZone; // $ExpectType Zone +Settings.defaultZone = Settings.defaultZone; Settings.throwOnInvalid = true; -Settings.now(); -Settings.now = () => 0; +Settings.now; // $ExpectType () => number +Settings.now = () => Date.now() + 3000; Settings.resetCaches(); -// $ExpectError -Settings.defaultZone = Settings.defaultZone; - // The following tests were coped from the docs // http://moment.github.io/luxon/docs/manual/