@naturalcycles/time-lib
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -0,1 +1,8 @@ | ||
# [1.5.0](https://github.com/NaturalCycles/time-lib/compare/v1.4.3...v1.5.0) (2019-08-21) | ||
### Features | ||
* dayjs().today() as alias to .startOf('day') ([b091ccc](https://github.com/NaturalCycles/time-lib/commit/b091ccc)) | ||
## [1.4.3](https://github.com/NaturalCycles/time-lib/compare/v1.4.2...v1.4.3) (2019-08-09) | ||
@@ -2,0 +9,0 @@ |
@@ -20,2 +20,6 @@ import { PluginFunc } from 'dayjs'; | ||
unixMillis(): number; | ||
/** | ||
* Shortcut for .startOf('day') | ||
*/ | ||
today(): Dayjs; | ||
} | ||
@@ -22,0 +26,0 @@ } |
@@ -20,3 +20,6 @@ "use strict"; | ||
}; | ||
dayjsClass.prototype.today = function () { | ||
return this.startOf('day'); | ||
}; | ||
}; | ||
//# sourceMappingURL=default.js.map |
@@ -10,3 +10,2 @@ { | ||
"@naturalcycles/js-lib": "^8.2.1", | ||
"@naturalcycles/semantic-release": "^1.0.0", | ||
"@naturalcycles/test-lib": "^1.0.0", | ||
@@ -27,2 +26,3 @@ "@types/node": "^12.0.2", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
@@ -38,3 +38,3 @@ "access": "public" | ||
}, | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"description": "Date/time related API, based on DayJS", | ||
@@ -41,0 +41,0 @@ "keywords": [ |
@@ -26,2 +26,7 @@ import { Dayjs, PluginFunc } from 'dayjs' | ||
/** | ||
* Shortcut for .startOf('day') | ||
*/ | ||
today (): Dayjs | ||
/** | ||
* Forbid the method in favor of .toISODate() | ||
@@ -44,17 +49,21 @@ */ | ||
export const defaultPlugins: PluginFunc = (_opt, dayjsClass, _dayjsFactory) => { | ||
dayjsClass.prototype.toISODate = function (this: Dayjs) { | ||
dayjsClass.prototype.toISODate = function (this: Dayjs): string { | ||
return this.format(DAYJS_ISO_DATE) | ||
} | ||
dayjsClass.prototype.toPretty = function (this: Dayjs) { | ||
dayjsClass.prototype.toPretty = function (this: Dayjs): string { | ||
return this.format(DAYJS_PRETTY_TIME) | ||
} | ||
dayjsClass.prototype.toCompactTime = function (this: Dayjs, seconds = false) { | ||
dayjsClass.prototype.toCompactTime = function (this: Dayjs, seconds = false): string { | ||
return this.format(seconds ? DAYJS_COMPACT_TIME_SECONDS : DAYJS_COMPACT_TIME) | ||
} | ||
dayjsClass.prototype.unixMillis = function (this: Dayjs) { | ||
dayjsClass.prototype.unixMillis = function (this: Dayjs): number { | ||
return this.valueOf() | ||
} | ||
dayjsClass.prototype.today = function (this: Dayjs): Dayjs { | ||
return this.startOf('day') | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
24956
6
470