cleanup & comments

This commit is contained in:
Sami Samhuri 2011-03-03 19:18:29 -08:00
parent 157a85e8c2
commit 7a807339ce

View file

@ -32,17 +32,15 @@
return hour; return hour;
} }
// loc is a function that maps the default English names to localized // locale is an object with the same structure as DefaultLocale
// names. In most cases it will just look up strings in a map but it's
// a function for added flexibility.
function strftime(fmt, d, locale) { 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)) { if (d && !(d instanceof Date)) {
locale = d; locale = d;
d = new Date(); d = undefined;
} }
locale = locale || DefaultLocale;
d = d || new Date(); d = d || new Date();
locale = locale || DefaultLocale;
// Most of the specifiers supported by C's strftime // Most of the specifiers supported by C's strftime
return fmt.replace(/%(.)/g, function(_, c) { return fmt.replace(/%(.)/g, function(_, c) {