mirror of
https://github.com/samsonjs/strftime.git
synced 2026-04-27 14:57:37 +00:00
Export strftime directly in Node, as module.exports, closes #10
This commit is contained in:
parent
b51b106177
commit
c93f523951
2 changed files with 5 additions and 5 deletions
|
|
@ -13,12 +13,12 @@ npm install strftime
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
var strftime = require('strftime').strftime
|
var strftime = require('strftime')
|
||||||
console.log(strftime('%B %d, %y %H:%M:%S')) // => April 28, 2011 18:21:08
|
console.log(strftime('%B %d, %y %H:%M:%S')) // => April 28, 2011 18:21:08
|
||||||
|
|
||||||
If you want to localize it:
|
If you want to localize it:
|
||||||
|
|
||||||
var strftime = require('strftime').strftime
|
var strftime = require('strftime')
|
||||||
var it_IT = {
|
var it_IT = {
|
||||||
days: [ 'domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato' ],
|
days: [ 'domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato' ],
|
||||||
shortDays: [ 'dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab' ],
|
shortDays: [ 'dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab' ],
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
var namespace;
|
var namespace;
|
||||||
|
|
||||||
// CommonJS / Node module
|
// CommonJS / Node module
|
||||||
if (typeof exports !== 'undefined') {
|
if (typeof module !== 'undefined') {
|
||||||
namespace = exports;
|
namespace = module.exports = strftime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Browsers and other environments
|
// Browsers and other environments
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
, PM: 'PM'
|
, PM: 'PM'
|
||||||
, am: 'am'
|
, am: 'am'
|
||||||
, pm: 'pm'
|
, pm: 'pm'
|
||||||
}
|
};
|
||||||
|
|
||||||
function strftime(fmt, d, locale) {
|
function strftime(fmt, d, locale) {
|
||||||
return _strftime(fmt, d, locale, false);
|
return _strftime(fmt, d, locale, false);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue