Commit bffc2eea authored by Mark Cote's avatar Mark Cote

If found, use strftime function of date objects instead of built-in formatting.

parent a54ec4ad
......@@ -15,6 +15,9 @@ for details.
// Returns a string with the date d formatted according to fmt.
// A subset of the Open Group's strftime format is supported.
function formatDate(d, fmt, monthNames, dayNames) {
if (typeof d.strftime == "function") {
return d.strftime(fmt);
}
var leftPad = function(n, pad) {
n = "" + n;
pad = "" + (pad == null ? "0" : pad);
......@@ -82,11 +85,14 @@ for details.
targetMethod) {
sourceObj[sourceMethod] = function() {
return targetObj[targetMethod].apply(targetObj, arguments);
}
};
};
var utc = {
date: d
};
// support strftime, if found
if (d.strftime != undefined)
addProxyMethod(utc, "strftime", d, "strftime");
addProxyMethod(utc, "getTime", d, "getTime");
addProxyMethod(utc, "setTime", d, "setTime");
var props = [ "Date", "Day", "FullYear", "Hours", "Milliseconds", "Minutes", "Month", "Seconds" ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment