package.initializers.dayjs.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
import pureDayjs from "dayjs";
import advancedFormat from "dayjs/plugin/advancedFormat";
import customParseFormat from "dayjs/plugin/customParseFormat";
import duration from "dayjs/plugin/duration";
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import isToday from "dayjs/plugin/isToday";
import localeData from "dayjs/plugin/localeData";
import localizedFormat from "dayjs/plugin/localizedFormat";
import minMax from "dayjs/plugin/minMax";
import quarterOfYear from "dayjs/plugin/quarterOfYear";
import relativeTime from "dayjs/plugin/relativeTime";
import timezone from "dayjs/plugin/timezone";
import updateLocale from "dayjs/plugin/updateLocale";
import utc from "dayjs/plugin/utc";
import weekday from "dayjs/plugin/weekday";
import weekOfYear from "dayjs/plugin/weekOfYear";
// const isValidTimezone = timezone => {
// try {
// pureDayjs().tz(timezone);
// return true;
// } catch {
// return false;
// }
// };
// eslint-disable-next-line no-unused-vars
var initializeDayjs = function initializeDayjs() {
var skipTimezone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
pureDayjs.extend(advancedFormat);
pureDayjs.extend(customParseFormat);
pureDayjs.extend(duration);
pureDayjs.extend(isSameOrAfter);
pureDayjs.extend(isSameOrBefore);
pureDayjs.extend(isToday);
pureDayjs.extend(localeData);
pureDayjs.extend(localizedFormat);
pureDayjs.extend(minMax);
pureDayjs.extend(quarterOfYear);
pureDayjs.extend(relativeTime);
pureDayjs.extend(timezone);
pureDayjs.extend(updateLocale);
pureDayjs.extend(utc);
pureDayjs.extend(weekday);
pureDayjs.extend(weekOfYear);
// const shouldInitializeTimezone =
// !skipTimezone &&
// globalProps?.user?.timeZone &&
// isValidTimezone(globalProps?.user?.timeZone);
// if (shouldInitializeTimezone) {
// pureDayjs.tz.setDefault(globalProps?.user?.timeZone);
// }
};
export default initializeDayjs;
//# sourceMappingURL=dayjs.js.map