dev #160
@ -2,8 +2,10 @@
|
|||||||
declare global {
|
declare global {
|
||||||
interface Date {
|
interface Date {
|
||||||
toJSONLocal: () => string;
|
toJSONLocal: () => string;
|
||||||
|
toLocal: () => string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Date.prototype.toJSONLocal = function () {
|
Date.prototype.toJSONLocal = function () {
|
||||||
function addZ(n: number): string {
|
function addZ(n: number): string {
|
||||||
return n <= 9 ? `0${n}` : `${n}`;
|
return n <= 9 ? `0${n}` : `${n}`;
|
||||||
@ -13,7 +15,27 @@ Date.prototype.toJSONLocal = function () {
|
|||||||
addZ(this.getMonth() + 1),
|
addZ(this.getMonth() + 1),
|
||||||
addZ(this.getDate()),
|
addZ(this.getDate()),
|
||||||
].join("-");
|
].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
|
// ARRAY EXTENTION
|
||||||
declare global {
|
declare global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user