日期过滤器

xmf f38c4b9c98 create libary 3 years ago
lib f38c4b9c98 create libary 3 years ago
src f38c4b9c98 create libary 3 years ago
.gitignore f38c4b9c98 create libary 3 years ago
.npmignore f38c4b9c98 create libary 3 years ago
README.md f38c4b9c98 create libary 3 years ago
package-lock.json f38c4b9c98 create libary 3 years ago
package.json f38c4b9c98 create libary 3 years ago
webpack.config.js f38c4b9c98 create libary 3 years ago

README.md

1.04版本后支持node

{{ Date.now() | date '%T' }}  => '13:34:36'
{{ 'Wed Jan 20 2016 13:34:36 GMT+0800' | date '%T' }} => '13:34:36'
{{ 1453268193752 | date '%Y-%m-%d' }} => '2016-01-20'
{{ new Date | date '%I:%M:%s %p' }} => '1:39:22 PM'

more date parameters are listed below:

param explanation example
%a Abbreviated weekday. `{{ timestamp
%A Full weekday name. `{{ timestamp
%b Abbreviated month name. `{{ timestamp
%B Full month name `{{ timestamp
%c Preferred local date and time representation `{{ timestamp
%d Day of the month, zero-padded (01, 02, 03, etc.). `{{ timestamp
%-d Day of the month, not zero-padded (1,2,3, etc.). `{{ timestamp
%D Formats the date (dd/mm/yy). `{{ timestamp
%e Day of the month, blank-padded ( 1, 2, 3, etc.). `{{ timestamp
%F Returns the date in ISO 8601 format (yyyy-mm-dd). `{{ timestamp
%H Hour of the day, 24-hour clock (00 - 23). `{{ timestamp
%I Hour of the day, 12-hour clock (1 - 12). `{{ timestamp
%j Day of the year (001 - 366). `{{ timestamp
%k Hour of the day, 24-hour clock (1 - 24). `{{ timestamp
%m Month of the year (01 - 12). `{{ timestamp
%M Minute of the hour (00 - 59). `{{ timestamp
%p Meridian indicator (AM/PM). `{{ timestamp
%r 12-hour time (%I:%M:%S %p) `{{ timestamp
%R 24-hour time (%H:%M) `{{ timestamp
%T 24-hour time (%H:%M:%S) `{{ timestamp
%U The number of the week in the current year, starting with the first Sunday as the first day of the first week. `{{ timestamp
%W The number of the week in the current year, starting with the first Monday as the first day of the first week. `{{ timestamp
%w Day of the week (0 - 6, with Sunday being 0). `{{ timestamp
%x Preferred representation for the date alone, no time. (mm/dd/yy). `{{ timestamp
%X Preferred representation for the time. (hh:mm:ss). `{{ timestamp
%y Year without a century (00.99). `{{ timestamp
%Y Year with a century. `{{ timestamp