useDate
一个用来操作时间的 Hook 。
内部使用了 dayjs 作为format工具
使用Demo
useDate接受一个时间并根据options来返回格式化后的数据。 可根据返回的refresh来进行更新调用.
其中method的参数具体使用可以参考dayjs的 取值/赋值
Api
Params
参数
说明
类型
默认值
initialValue
初始化的时间值
string - number - Date
Date
options
可选项,配置时间属性,详见 Options
Options
-
Options
参数
说明
类型
默认值
format
针对日期格式化
string
YYYY-MM-DD HH:mm:ss
method
获取时间的操作方法
见Api Options.method
format
methodParam
针对日期格式化的操作方法的参数
number
-
Result
参数
说明
类型
data
格式化后的时间值
Ref
refresh
格式化后的时间值
(refreshValue)=> void
最后更新于
这有帮助吗?