ph-utils 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/date.d.ts +2 -2
- package/lib/date.js +3 -3
- package/package.json +1 -1
package/lib/date.d.ts
CHANGED
@@ -34,10 +34,10 @@ export declare function endOf(date?: Date | string | number, unit?: string): Dat
|
|
34
34
|
/**
|
35
35
|
* 获取时间戳
|
36
36
|
* @param ctime 时间
|
37
|
-
* @param
|
37
|
+
* @param pre 精度, s - 精确到秒, ms - 精确到毫秒, 默认: s
|
38
38
|
* @returns
|
39
39
|
*/
|
40
|
-
export declare function timeStamp(ctime?: Date | string | number,
|
40
|
+
export declare function timeStamp(ctime?: Date | string | number, pre?: 's' | 'ms'): number;
|
41
41
|
/**
|
42
42
|
* 日期加上指定时间后的日期
|
43
43
|
* @param date 指定的日期
|
package/lib/date.js
CHANGED
@@ -166,12 +166,12 @@ export function endOf(date, unit) {
|
|
166
166
|
/**
|
167
167
|
* 获取时间戳
|
168
168
|
* @param ctime 时间
|
169
|
-
* @param
|
169
|
+
* @param pre 精度, s - 精确到秒, ms - 精确到毫秒, 默认: s
|
170
170
|
* @returns
|
171
171
|
*/
|
172
|
-
export function timeStamp(ctime,
|
172
|
+
export function timeStamp(ctime, pre = 's') {
|
173
173
|
let tm = parse(ctime).getTime();
|
174
|
-
return
|
174
|
+
return pre === 's' ? Math.floor(tm / 1000) : tm;
|
175
175
|
}
|
176
176
|
/**
|
177
177
|
* 日期加上指定时间后的日期
|