(function() {
'use strict';
function pad(n) {
return n < 10 ? '0' + n : '' + n;
}
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];
const monthNamesShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const dayNamesShort = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
Date.prototype.toLocaleString = function(locales, options) {
if (isNaN(this.getTime())) {
return 'Invalid Date';
}
const month = pad(this.getMonth() + 1);
const date = pad(this.getDate());
const year = this.getFullYear();
const hours = this.getHours();
const minutes = pad(this.getMinutes());
const seconds = pad(this.getSeconds());
const hour12 = hours % 12 || 12;
const ampm = hours >= 12 ? 'PM' : 'AM';
return `${month}/${date}/${year}, ${hour12}:${minutes}:${seconds} ${ampm}`;
};
Date.prototype.toLocaleDateString = function(locales, options) {
if (isNaN(this.getTime())) {
return 'Invalid Date';
}
const month = pad(this.getMonth() + 1);
const date = pad(this.getDate());
const year = this.getFullYear();
return `${month}/${date}/${year}`;
};
Date.prototype.toLocaleTimeString = function(locales, options) {
if (isNaN(this.getTime())) {
return 'Invalid Date';
}
const hours = this.getHours();
const minutes = pad(this.getMinutes());
const seconds = pad(this.getSeconds());
const hour12 = hours % 12 || 12;
const ampm = hours >= 12 ? 'PM' : 'AM';
return `${hour12}:${minutes}:${seconds} ${ampm}`;
};
})();