mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +00:00
cleanup & comments
This commit is contained in:
parent
157a85e8c2
commit
7a807339ce
1 changed files with 4 additions and 6 deletions
10
lib/index.js
10
lib/index.js
|
|
@ -32,17 +32,15 @@
|
|||
return hour;
|
||||
}
|
||||
|
||||
// loc is a function that maps the default English names to localized
|
||||
// names. In most cases it will just look up strings in a map but it's
|
||||
// a function for added flexibility.
|
||||
// locale is an object with the same structure as DefaultLocale
|
||||
function strftime(fmt, d, locale) {
|
||||
// d and loc are optional, check if d is really loc
|
||||
// d and locale are optional so check if d is really the locale
|
||||
if (d && !(d instanceof Date)) {
|
||||
locale = d;
|
||||
d = new Date();
|
||||
d = undefined;
|
||||
}
|
||||
locale = locale || DefaultLocale;
|
||||
d = d || new Date();
|
||||
locale = locale || DefaultLocale;
|
||||
|
||||
// Most of the specifiers supported by C's strftime
|
||||
return fmt.replace(/%(.)/g, function(_, c) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue