cafe-utility 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.js +5 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ declare function unixTimestamp(optionalTimestamp?: number): number;
|
|
|
148
148
|
declare function isoDate(optionalDate?: Date): string;
|
|
149
149
|
declare function dateTimeSlug(optionalDate?: Date): string;
|
|
150
150
|
declare function fromUtcString(string: string): Date;
|
|
151
|
+
declare function fromMillis(millis: number): Date;
|
|
151
152
|
declare function createTimeDigits(value: number): string;
|
|
152
153
|
declare function humanizeTime(millis: number): string;
|
|
153
154
|
declare function getAgo(date: Date, now?: number): string;
|
|
@@ -359,6 +360,7 @@ export declare const Dates: {
|
|
|
359
360
|
dateTimeSlug: typeof dateTimeSlug;
|
|
360
361
|
unixTimestamp: typeof unixTimestamp;
|
|
361
362
|
fromUtcString: typeof fromUtcString;
|
|
363
|
+
fromMillis: typeof fromMillis;
|
|
362
364
|
getProgress: typeof getProgress;
|
|
363
365
|
humanizeTime: typeof humanizeTime;
|
|
364
366
|
humanizeProgress: typeof humanizeProgress;
|
package/index.js
CHANGED
|
@@ -979,6 +979,10 @@ function fromUtcString(string) {
|
|
|
979
979
|
return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
+
function fromMillis(millis) {
|
|
983
|
+
return new Date(millis)
|
|
984
|
+
}
|
|
985
|
+
|
|
982
986
|
function createTimeDigits(value) {
|
|
983
987
|
return String(Math.floor(value)).padStart(2, '0')
|
|
984
988
|
}
|
|
@@ -1989,6 +1993,7 @@ exports.Dates = {
|
|
|
1989
1993
|
dateTimeSlug,
|
|
1990
1994
|
unixTimestamp,
|
|
1991
1995
|
fromUtcString,
|
|
1996
|
+
fromMillis,
|
|
1992
1997
|
getProgress,
|
|
1993
1998
|
humanizeTime,
|
|
1994
1999
|
humanizeProgress,
|