Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/date_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export function getDaysDiff(date1, date2) {
// ** Date Localization **

export function registerLocale(localeName, localeData) {
const scope = window || global;
const scope = typeof window !== "undefined" ? window : global;

if (!scope.__localeData__) {
scope.__localeData__ = {};
Expand All @@ -264,21 +264,21 @@ export function registerLocale(localeName, localeData) {
}

export function setDefaultLocale(localeName) {
const scope = window || global;
const scope = typeof window !== "undefined" ? window : global;

scope.__localeId__ = localeName;
}

export function getDefaultLocale() {
const scope = window || global;
const scope = typeof window !== "undefined" ? window : global;

return scope.__localeId__;
}

export function getLocaleObject(localeSpec) {
if (typeof localeSpec === "string") {
// Treat it as a locale name registered by registerLocale
const scope = window || global;
const scope = typeof window !== "undefined" ? window : global;
return scope.__localeData__ ? scope.__localeData__[localeSpec] : null;
} else {
// Treat it as a raw date-fns locale object
Expand Down