mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 06:27:59 +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
|
||||
|
||||
function get_date_string(date) {
|
||||
var year = date.getFullYear().toString();
|
||||
var month = date.getMonth().toString();
|
||||
var day = date.getDay().toString();
|
||||
|
||||
if (month.length === 1) {
|
||||
month = "0" + month;
|
||||
}
|
||||
|
||||
if (day.length === 1) {
|
||||
day = "0" + day
|
||||
}
|
||||
var year = date.getUTCFullYear().toString();
|
||||
var month = (date.getUTCMonth() + 1).toString().padStart(2, "0");
|
||||
var day = date.getUTCDate().toString().padStart(2, "0");
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
@ -127,6 +119,7 @@ async function request(method, path, body = null) {
|
|||
|
||||
} else {
|
||||
if (Object.hasOwn(message, "created")) {
|
||||
console.log(message.created)
|
||||
message.created = new Date(message.created);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue