From 7a807339ce7c7d433283255cd74b911e605efb60 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 3 Mar 2011 19:18:29 -0800 Subject: [PATCH] cleanup & comments --- lib/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 48b5f9c..1364cd8 100644 --- a/lib/index.js +++ b/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) {