dev #160
@ -2,8 +2,10 @@
|
||||
declare global {
|
||||
interface Date {
|
||||
toJSONLocal: () => string;
|
||||
toLocal: () => string;
|
||||
}
|
||||
}
|
||||
|
||||
Date.prototype.toJSONLocal = function () {
|
||||
function addZ(n: number): string {
|
||||
return n <= 9 ? `0${n}` : `${n}`;
|
||||
@ -13,7 +15,27 @@ Date.prototype.toJSONLocal = function () {
|
||||
addZ(this.getMonth() + 1),
|
||||
addZ(this.getDate()),
|
||||
].join("-");
|
||||
};
|
||||
}
|
||||
|
||||
Date.prototype.toLocal = function () {
|
||||
return [["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][this.getDay()],
|
||||
this.getDate(),
|
||||
[
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec",
|
||||
][this.getMonth()]].join(" ")
|
||||
;
|
||||
}
|
||||
|
||||
// ARRAY EXTENTION
|
||||
declare global {
|
||||
@ -76,4 +98,4 @@ String.gen_id = function (length) {
|
||||
.join("");
|
||||
};
|
||||
|
||||
export {};
|
||||
export { };
|
||||
|
Loading…
x
Reference in New Issue
Block a user