@naturalcycles/time-lib
Advanced tools
Comparing version
@@ -0,1 +1,8 @@ | ||
## [1.6.3](https://github.com/NaturalCycles/time-lib/compare/v1.6.2...v1.6.3) (2019-11-09) | ||
### Bug Fixes | ||
* esm build ([b393a07](https://github.com/NaturalCycles/time-lib/commit/b393a0762704a3e619d5d269579c6ef4063c489f)) | ||
## [1.6.2](https://github.com/NaturalCycles/time-lib/compare/v1.6.1...v1.6.2) (2019-11-09) | ||
@@ -2,0 +9,0 @@ |
@@ -27,4 +27,7 @@ import * as dayjs from 'dayjs'; | ||
import './plugin/isoWeekday'; | ||
import './plugin/localeData'; | ||
import './plugin/weekOfYear'; | ||
; | ||
dayjs.extendLocale = function (ext) { | ||
dayjs.locale(Object.assign(Object.assign({}, dayjs().$locale()), ext)); | ||
}; | ||
// Default weekStart to Monday | ||
@@ -31,0 +34,0 @@ dayjs.extendLocale({ |
@@ -10,4 +10,19 @@ import * as dayjs from 'dayjs'; | ||
import './plugin/isoWeekday'; | ||
import './plugin/localeData'; | ||
import './plugin/weekOfYear'; | ||
export interface DayjsLocale { | ||
name: string; | ||
weekStart?: number; | ||
weekdays?: string[]; | ||
months?: string[]; | ||
[k: string]: any; | ||
} | ||
declare module 'dayjs' { | ||
interface Dayjs { | ||
/** | ||
* Returns internal locale data | ||
*/ | ||
$locale(): DayjsLocale; | ||
} | ||
function extendLocale(ext: Partial<DayjsLocale>): void; | ||
} | ||
export { Dayjs, dayjs }; |
@@ -31,4 +31,7 @@ "use strict"; | ||
require("./plugin/isoWeekday"); | ||
require("./plugin/localeData"); | ||
require("./plugin/weekOfYear"); | ||
; | ||
dayjs.extendLocale = function (ext) { | ||
dayjs.locale(Object.assign(Object.assign({}, dayjs().$locale()), ext)); | ||
}; | ||
// Default weekStart to Monday | ||
@@ -35,0 +38,0 @@ dayjs.extendLocale({ |
@@ -1,5 +0,4 @@ | ||
import { dayjs, Dayjs } from './dayjs.full'; | ||
import { DayjsLocale } from './plugin/localeData'; | ||
import { dayjs, Dayjs, DayjsLocale } from './dayjs.full'; | ||
import { ms, since, TS_2018_06_21 } from './time.util'; | ||
export { dayjs, // should be imported from dayjs.full, cause it's an extended version | ||
Dayjs, DayjsLocale, TS_2018_06_21, since, ms, }; |
@@ -30,3 +30,2 @@ { | ||
"sideEffects": [ | ||
"./dist/dayjs.full.js", | ||
"./dist-esm/dayjs.full.js" | ||
@@ -44,3 +43,3 @@ ], | ||
}, | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Date/time related API, based on DayJS", | ||
@@ -47,0 +46,0 @@ "keywords": [ |
@@ -29,5 +29,32 @@ import * as dayjs from 'dayjs' | ||
import './plugin/isoWeekday' | ||
import './plugin/localeData' | ||
import './plugin/weekOfYear' | ||
export interface DayjsLocale { | ||
name: string | ||
weekStart?: number | ||
weekdays?: string[] | ||
months?: string[] | ||
[k: string]: any | ||
// todo: complete | ||
// Doc: https://github.com/iamkun/dayjs/blob/dev/docs/en/I18n.md#customize | ||
} | ||
declare module 'dayjs' { | ||
interface Dayjs { | ||
/** | ||
* Returns internal locale data | ||
*/ | ||
$locale(): DayjsLocale | ||
} | ||
export function extendLocale(ext: Partial<DayjsLocale>): void | ||
} | ||
;(dayjs as any).extendLocale = function(ext: any) { | ||
dayjs.locale({ | ||
...dayjs().$locale(), | ||
...ext, | ||
}) | ||
} | ||
// Default weekStart to Monday | ||
@@ -34,0 +61,0 @@ dayjs.extendLocale({ |
@@ -1,3 +0,2 @@ | ||
import { dayjs, Dayjs } from './dayjs.full' | ||
import { DayjsLocale } from './plugin/localeData' | ||
import { dayjs, Dayjs, DayjsLocale } from './dayjs.full' | ||
import { ms, since, TS_2018_06_21 } from './time.util' | ||
@@ -4,0 +3,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38457
-1.48%39
-13.33%638
-1.69%