# sprintf-ext-strftime
Date/time formatting extension for
sprintf-js
(viastrftime
)
Overview
It's the very experimental module to try the new feature that proposed to sprintf-js by me.
This feature allow to use an user defined type specifiers (any letter) and
bind such specifier with an user defined function. This function will be called
inside sprintf
to format sprintf
arguments according desired specification.
An additional formatting modifiers may be passed in the sprintf
format string if need.
You can use any existing formatting features of sprintf
together with such user defined type specifiers
(width, precision, padding and aligning). They will be applied to result of user function.
Getting Started
Install featured sprintf-js:
npm install https://github.com/litmit/sprintf.js.git#expandable
Install strftime:
npm install strftime
Install this extension:
npm install sprintf-ext-strftime
Now you can code:
var sprintf = sprintf;var strftime = ;var ssprintf_ext_strftime = ;sprintf_ext_strftime; // binded to 'D' type specifier by default var { var o = sprintf; console; return olength; }; var now = 2016112203344555; ; // --> Now [December 22, 2016 00:33:44]; // --> Now 2016-12-22 00:33:44 // more over you can bind localized version of strftime to another type specifier// and use it simultaneouslysprintf_ext_strftime; ;// --> Сейчас [Декабрь 22, 2016 00:33:44]/[December 22, 2016 00:33:44]
See also
sprintf-js:
Available extensions for- sprintf-ext-strftime - Date/time formatting extension for
sprintf-js
(viastrftime
) - sprintf-ext-string - String formatting extension for
sprintf-js