Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3e4d40d

Browse files
committedJul 13, 2013
Merge pull request locutusjs#103 from mackshot/master
functions/datetime/date.js bugfix and small performance improvement locutusjs#2
2 parents 0035d7c + 1132816 commit 3e4d40d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎functions/datetime/date.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ function date (format, timestamp) {
6969
return f[t] ? f[t]() : s;
7070
},
7171
_pad = function (n, c) {
72-
n = n.toString();
73-
return n.length < c ? _pad('0' + n, c) : n;
72+
n = String(n);
73+
while (n.length < c) n = '0' + n;
74+
return n;
7475
};
7576
f = {
7677
// Day

0 commit comments

Comments
 (0)
Failed to load comments.