Options
All
  • Public
  • Public/Protected
  • All
Menu

Module time/day

Index

Functions

Functions

createDayjs

0.0.35 provide
  • createDayjs(time?: string | number | Date): dayjs.Dayjs | undefined
  • 创建dayjs实例的工厂函数

    remarks

    通过此函数创建dayjs.Dayjs实例 支持传入字符串(字符串描述)、时间戳(10位、13位、unix类型)、Date对象 Links can point to a URL: dayjs

    example

    string

    import { time } from 'onex-utils';
    const t1 = time.createDayjs('2020-01-01')
    
    example

    number

    import { time } from 'onex-utils';
    const t1 = time.createDayjs(1609518911614);
    
    example

    Date

    import { time } from 'onex-utils';
    const currentTime = new Date();
    const t1 = time.createDayjs(currentTime);
    

    Parameters

    • Optional time: string | number | Date

    Returns dayjs.Dayjs | undefined

    dayjs instance