UNPKG

yzf-date-format

Version:

日期格式化

22 lines (19 loc) 951 B
完整压缩版-欢迎使用(5.09 kB) ### ** 版权属于yzflhez@126.com #### DFormat(value, format)日期Filter // const aa = DFormat('2018-08-12', 'YYYY-MM-DD hh:mm:ss'); 第三个参数默认是' ' // const aa = DFormat('2018-08-12', 'YYYY-MM-DD~hh:mm:ss', '~'); 2018-08-12 ~ 08:02:36 // const aa = DFormat('2018-08-12', ['YYYY-MM-DD', 'hh:mm:ss'], '~'); 2018-08-12 ~ 08:02:36 // DFormat('2018-08-12 12:35:24', 'YYYY~MM') => 2018~08 // DFormat('2018-08-12 12:35:24', 'MM-D') => 08-12 // DFormat('2018-08-12 12:35:24', 'YYYY~MM hh:mm') => 2018~08 12:35 // DFormat('2018-08-12 12:35:24', 'YYYY~MM/DD mm/ss', '<=>') => 2018~08/12<=>35/24 #### AddDate(value, length) 日期加length天 // const cc = AddDate(null, 61); #### AddMonth(value, length) 日期加length月 // const dd = AddMonth(null, 2); ### 模块引入 ##### ~ tnpm install yzf-date-format --save ##### ~ import { NFormat } from 'yzf-date-format';