mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
properly get date on api requests from frontend
This commit is contained in:
parent
058df0ac78
commit
cad7f47e7e
|
@ -57,17 +57,9 @@ body.addEventListener("click", (event) => {
|
||||||
// misc
|
// misc
|
||||||
|
|
||||||
function get_date_string(date) {
|
function get_date_string(date) {
|
||||||
var year = date.getFullYear().toString();
|
var year = date.getUTCFullYear().toString();
|
||||||
var month = date.getMonth().toString();
|
var month = (date.getUTCMonth() + 1).toString().padStart(2, "0");
|
||||||
var day = date.getDay().toString();
|
var day = date.getUTCDate().toString().padStart(2, "0");
|
||||||
|
|
||||||
if (month.length === 1) {
|
|
||||||
month = "0" + month;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (day.length === 1) {
|
|
||||||
day = "0" + day
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${year}-${month}-${day}`;
|
return `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +119,7 @@ async function request(method, path, body = null) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (Object.hasOwn(message, "created")) {
|
if (Object.hasOwn(message, "created")) {
|
||||||
|
console.log(message.created)
|
||||||
message.created = new Date(message.created);
|
message.created = new Date(message.created);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue