@naturalcycles/time-lib
Advanced tools
Comparing version 3.4.0 to 3.4.1
import * as dayjsLib from 'dayjs'; | ||
// const dayjsLib = require('dayjs') | ||
const dayjs = dayjsLib; | ||
import * as enGB from 'dayjs/locale/en-gb'; | ||
import * as isBetween from 'dayjs/plugin/isBetween'; | ||
@@ -14,2 +13,3 @@ import * as isSameOrAfter from 'dayjs/plugin/isSameOrAfter'; | ||
import * as utc from 'dayjs/plugin/utc'; | ||
import { enGB } from './enGB'; | ||
import { defaultPlugins } from './plugin/default'; | ||
@@ -32,3 +32,6 @@ import { isoWeekdayPlugin } from './plugin/isoWeekday'; | ||
// Set en-gb by default, to have e.g Monday as fdow | ||
dayjsLib.locale(enGB); | ||
// This "loads" the locale: | ||
dayjs.locale(enGB, null, true); | ||
// This sets en-gb as default: | ||
dayjs.locale('en-gb'); | ||
export { dayjs }; |
@@ -8,3 +8,2 @@ "use strict"; | ||
exports.dayjs = dayjs; | ||
const enGB = require("dayjs/locale/en-gb"); | ||
const isBetween = require("dayjs/plugin/isBetween"); | ||
@@ -19,2 +18,3 @@ const isSameOrAfter = require("dayjs/plugin/isSameOrAfter"); | ||
const utc = require("dayjs/plugin/utc"); | ||
const enGB_1 = require("./enGB"); | ||
const default_1 = require("./plugin/default"); | ||
@@ -37,2 +37,5 @@ const isoWeekday_1 = require("./plugin/isoWeekday"); | ||
// Set en-gb by default, to have e.g Monday as fdow | ||
dayjsLib.locale(enGB); | ||
// This "loads" the locale: | ||
dayjs.locale(enGB_1.enGB, null, true); | ||
// This sets en-gb as default: | ||
dayjs.locale('en-gb'); |
import { dayjs } from './dayjs.full'; | ||
import { DAYJS_TIME_HM, DAYJS_TIME_HMS, DAYJS_ISO_DATE, DAYJS_COMPACT_DATE, DAYJS_COMPACT_TIME, DAYJS_COMPACT_TIME_SECONDS } from './plugin/default'; | ||
import { IDayjs, IDayjsFactory, IDayjsLocale, ConfigType, OpUnitType } from './types'; | ||
import { IDayjs, IDayjsFactory, IDayjsLocale, ConfigType, OpUnitType, GlobalLocaleDataReturn } from './types'; | ||
import { dayjsRange, dayjsRangeIncl, dayjsRangeInclISODate, dayjsRangeISODate } from './dayjsRange'; | ||
export type { IDayjsFactory, IDayjs, IDayjsLocale, ConfigType, OpUnitType }; | ||
export type { IDayjsFactory, IDayjs, IDayjsLocale, ConfigType, OpUnitType, GlobalLocaleDataReturn }; | ||
export { dayjs, // should be imported from dayjs.full, cause it's an extended version | ||
DAYJS_TIME_HM, DAYJS_TIME_HMS, DAYJS_ISO_DATE, DAYJS_COMPACT_DATE, DAYJS_COMPACT_TIME, DAYJS_COMPACT_TIME_SECONDS, dayjsRange, dayjsRangeIncl, dayjsRangeInclISODate, dayjsRangeISODate, }; |
@@ -12,2 +12,17 @@ export declare type ConfigType = string | number | Date | IDayjs; | ||
export declare type PluginFunc<T = unknown> = (option: T, c: IDayjsFactory, d: IDayjsFactory) => void; | ||
export declare type WeekdayNames = [string, string, string, string, string, string, string]; | ||
export declare type MonthNames = [ | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string | ||
]; | ||
export interface IDayjsFactory { | ||
@@ -134,3 +149,3 @@ (cfg?: ConfigType, option?: OptionType, locale?: string): IDayjs; | ||
$locale(): IDayjsLocale; | ||
localeData(): IDayjsLocale; | ||
localeData(): GlobalLocaleDataReturn; | ||
} | ||
@@ -181,1 +196,11 @@ export interface IDayjsLocale { | ||
} | ||
export interface GlobalLocaleDataReturn { | ||
firstDayOfWeek(): number; | ||
weekdays(): WeekdayNames; | ||
weekdaysShort(): WeekdayNames; | ||
weekdaysMin(): WeekdayNames; | ||
months(): MonthNames; | ||
monthsShort(): MonthNames; | ||
longDateFormat(format: string): string; | ||
meridiem(hour?: number, minute?: number, isLower?: boolean): string; | ||
} |
@@ -32,5 +32,3 @@ { | ||
"module": "dist-esm/index.js", | ||
"sideEffects": [ | ||
"./dist-esm/dayjs.full.js" | ||
], | ||
"sideEffects": false, | ||
"publishConfig": { | ||
@@ -46,3 +44,3 @@ "access": "public" | ||
}, | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Date/time related API, based on Day.js", | ||
@@ -49,0 +47,0 @@ "keywords": [ |
@@ -5,4 +5,2 @@ import * as dayjsLib from 'dayjs' | ||
import * as enGB from 'dayjs/locale/en-gb' | ||
import * as isBetween from 'dayjs/plugin/isBetween' | ||
@@ -17,2 +15,3 @@ import * as isSameOrAfter from 'dayjs/plugin/isSameOrAfter' | ||
import * as utc from 'dayjs/plugin/utc' | ||
import { enGB } from './enGB' | ||
import { defaultPlugins } from './plugin/default' | ||
@@ -37,4 +36,7 @@ import { isoWeekdayPlugin } from './plugin/isoWeekday' | ||
// Set en-gb by default, to have e.g Monday as fdow | ||
dayjsLib.locale(enGB) | ||
// This "loads" the locale: | ||
dayjs.locale(enGB, null, true) | ||
// This sets en-gb as default: | ||
dayjs.locale('en-gb') | ||
export { dayjs } |
@@ -10,6 +10,13 @@ import { dayjs } from './dayjs.full' | ||
} from './plugin/default' | ||
import { IDayjs, IDayjsFactory, IDayjsLocale, ConfigType, OpUnitType } from './types' | ||
import { | ||
IDayjs, | ||
IDayjsFactory, | ||
IDayjsLocale, | ||
ConfigType, | ||
OpUnitType, | ||
GlobalLocaleDataReturn, | ||
} from './types' | ||
import { dayjsRange, dayjsRangeIncl, dayjsRangeInclISODate, dayjsRangeISODate } from './dayjsRange' | ||
export type { IDayjsFactory, IDayjs, IDayjsLocale, ConfigType, OpUnitType } | ||
export type { IDayjsFactory, IDayjs, IDayjsLocale, ConfigType, OpUnitType, GlobalLocaleDataReturn } | ||
@@ -16,0 +23,0 @@ export { |
@@ -22,2 +22,18 @@ export type ConfigType = string | number | Date | IDayjs | ||
export type WeekdayNames = [string, string, string, string, string, string, string] | ||
export type MonthNames = [ | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
string, | ||
] | ||
export interface IDayjsFactory { | ||
@@ -218,3 +234,3 @@ (cfg?: ConfigType, option?: OptionType, locale?: string): IDayjs | ||
$locale(): IDayjsLocale | ||
localeData(): IDayjsLocale | ||
localeData(): GlobalLocaleDataReturn | ||
} | ||
@@ -268,1 +284,12 @@ | ||
} | ||
export interface GlobalLocaleDataReturn { | ||
firstDayOfWeek(): number | ||
weekdays(): WeekdayNames | ||
weekdaysShort(): WeekdayNames | ||
weekdaysMin(): WeekdayNames | ||
months(): MonthNames | ||
monthsShort(): MonthNames | ||
longDateFormat(format: string): string | ||
meridiem(hour?: number, minute?: number, isLower?: boolean): string | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51525
42
1296