0.3.2 • Published 5 years ago

pandaman v0.3.2

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

pandaman

一个简单易上手的工具库

install

$ npm install --save pandaman

API

date

这是一个柯里化的方法,用例如下 Standard Date and Time Format Specifiers

FormatDescriptionExample
sThe seconds of the minute between 0-59."0" to "59"
ssThe seconds of the minute with leading zero if required."00" to "59"
mThe minute of the hour between 0-59."0" or "59"
mmThe minute of the hour with leading zero if required."00" or "59"
hThe hour of the day between 1-12."1" to "12"
hhThe hour of the day with leading zero if required."01" to "12"
HThe hour of the day between 0-23."0" to "23"
HHThe hour of the day with leading zero if required."00" to "23"
dThe day of the month between 1 and 31."1" to "31"
ddThe day of the month with leading zero if required."01" to "31"
dddAbbreviated day name. Date.!CultureInfo.abbreviatedDayNames."Mon" to "Sun"
ddddThe full day name. Date.!CultureInfo.dayNames."Monday" to "Sunday"
MThe month of the year between 1-12."1" to "12"
MMThe month of the year with leading zero if required."01" to "12"
MMMAbbreviated month name. Date.!CultureInfo.abbreviatedMonthNames."Jan" to "Dec"
MMMMThe full month name. Date.!CultureInfo.monthNames."January" to "December"
yyDisplays the year as a two-digit number."99" or "07"
yyyyDisplays the full four digit year."1999" or "2007"
tDisplays the first character of the A.M./P.M. designator. Date.!CultureInfo.amDesignator or Date.!CultureInfo.pmDesignator"A" or "P"
ttDisplays the A.M./P.M. designator. Date.!CultureInfo.amDesignator or Date.!CultureInfo.pmDesignator"AM" or "PM"
SThe ordinal suffix ("st, "nd", "rd" or "th") of the current day."st, "nd", "rd" or "th"

Example:

import { date } from 'pandaman'
console.log(date(new Date())('yyyy年 MM月 dd日')()); // 2019年 04月 09日
// or
console.log(date(new Date())('yyyy年 MM月 dd日').toString());
// or
console.log('' + date(new Date())('yyyy年 MM月 dd日')());

// 柯里化表达
console.log(date(new Date())('yyyy年 MM月 dd日')('柯里化: yy-MMMM-d')()); //2019年 04月 09日柯里化: 19-April-9 

被用于格式化的字符(y M d等)不能用于连接符

0.3.2

5 years ago

0.2.2

5 years ago

0.1.2

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago