@librecoder/tools
Version:

39 lines (35 loc) • 815 B
JavaScript
import {formatDate, parseDate} from './date';
import {trim} from "./string";
import {clone} from "./utils";
if (!Date.format) Date.format = formatDate;
if (!Date.deformat) Date.deformat = parseDate;
if (!Date.prototype.clone) {
Object.defineProperty(Date.prototype, 'format', {
configurable: true,
enumerable: false,
writable: false,
value: function (fmt) {
return formatDate(this, fmt);
}
})
}
/*if (!Object.prototype.clone) {
Object.defineProperty(Object.prototype, 'clone', {
configurable: true,
enumerable: false,
writable: false,
value: function () {
return clone(this);
}
})
}*/
if (String.prototype.trim) {
Object.defineProperty(String.prototype, 'trim', {
configurable: true,
enumerable: false,
writable: false,
value: function () {
return trim(this);
}
})
}