@daysnap/utils 0.0.51 → 0.0.52

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.
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * 格式化日期
3
+ * 默认的当前日期 yyyy-MM-dd hh:mm:ss
3
4
  */
4
- export declare function formatDate(val: string | Date | number, fmt?: string): string;
5
+ export declare function formatDate(val?: string | Date | number, fmt?: string): string;
package/es/formatDate.js CHANGED
@@ -2,8 +2,9 @@ import { isString } from './isString';
2
2
  import { formatDateStr } from './formatDateStr';
3
3
  /**
4
4
  * 格式化日期
5
+ * 默认的当前日期 yyyy-MM-dd hh:mm:ss
5
6
  */
6
- export function formatDate(val, fmt = 'yyyy-MM-dd hh:mm:ss') {
7
+ export function formatDate(val = new Date(), fmt = 'yyyy-MM-dd hh:mm:ss') {
7
8
  let v = val;
8
9
  if (isString(v)) {
9
10
  // fix iOS new Date() 不支持 2020-01-01 格式,需转换为 2020/01/01
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * 格式化日期
3
+ * 默认的当前日期 yyyy-MM-dd hh:mm:ss
3
4
  */
4
- export declare function formatDate(val: string | Date | number, fmt?: string): string;
5
+ export declare function formatDate(val?: string | Date | number, fmt?: string): string;
package/lib/formatDate.js CHANGED
@@ -5,8 +5,9 @@ const isString_1 = require("./isString");
5
5
  const formatDateStr_1 = require("./formatDateStr");
6
6
  /**
7
7
  * 格式化日期
8
+ * 默认的当前日期 yyyy-MM-dd hh:mm:ss
8
9
  */
9
- function formatDate(val, fmt = 'yyyy-MM-dd hh:mm:ss') {
10
+ function formatDate(val = new Date(), fmt = 'yyyy-MM-dd hh:mm:ss') {
10
11
  let v = val;
11
12
  if ((0, isString_1.isString)(v)) {
12
13
  // fix iOS new Date() 不支持 2020-01-01 格式,需转换为 2020/01/01
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daysnap/utils",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "通用的工具库",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",