Skip to content

Commit baa41ec

Browse files
Merge pull request #3463 from InfiniteStack/fix/global
use globalThis instead of global
2 parents 03e872a + d140924 commit baa41ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/date_utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export function getDaysDiff(date1, date2) {
345345
// ** Date Localization **
346346

347347
export function registerLocale(localeName, localeData) {
348-
const scope = typeof window !== "undefined" ? window : global;
348+
const scope = typeof window !== "undefined" ? window : globalThis;
349349

350350
if (!scope.__localeData__) {
351351
scope.__localeData__ = {};
@@ -354,21 +354,21 @@ export function registerLocale(localeName, localeData) {
354354
}
355355

356356
export function setDefaultLocale(localeName) {
357-
const scope = typeof window !== "undefined" ? window : global;
357+
const scope = typeof window !== "undefined" ? window : globalThis;
358358

359359
scope.__localeId__ = localeName;
360360
}
361361

362362
export function getDefaultLocale() {
363-
const scope = typeof window !== "undefined" ? window : global;
363+
const scope = typeof window !== "undefined" ? window : globalThis;
364364

365365
return scope.__localeId__;
366366
}
367367

368368
export function getLocaleObject(localeSpec) {
369369
if (typeof localeSpec === "string") {
370370
// Treat it as a locale name registered by registerLocale
371-
const scope = typeof window !== "undefined" ? window : global;
371+
const scope = typeof window !== "undefined" ? window : globalThis;
372372
return scope.__localeData__ ? scope.__localeData__[localeSpec] : null;
373373
} else {
374374
// Treat it as a raw date-fns locale object

0 commit comments

Comments
 (0)