JSPM

dateformater-plus

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q25956F
    • License ISC

    提供了格式化时间、获取开始和结束时间相关的功能

    Package Exports

    • dateformater-plus
    • dateformater-plus/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dateformater-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    安装

    npm install date-formater

    导入

    在根组件或者main.js中,将方法绑定到Date的原型上
    import dateFormaterPlus from 'dateFormater-plus'
    window.Date.prototype.pattern=dateFormater.pattern
    window.Date.prototype.getTimeRange=dateFormater.getTimeRange

    格式化时间

    const timeStr=new Date().pattern('yyyy-MM-dd E HH:mm:ss')

    获取开始/结束时间数组

    const timeArr=new Date().getTimeRange('week')
    const timeArr=new Date('2021-08-01').getTimeRange('year')
    ......