diff --git a/blogin.sh b/blogin.sh index f3245ef..97b1bda 100644 --- a/blogin.sh +++ b/blogin.sh @@ -113,7 +113,7 @@ case "$action" in db_query "SET TIME ZONE 'UTC'; INSERT INTO posts (username, contents, ts) VALUES ( $(escape_sql_str "$user"), $(escape_sql_str "$status"), - $(escape_sql_str "$(date --rfc-3339=seconds)")::timestamp + $(escape_sql_str "$(date -u --rfc-3339=seconds)")::timestamp ) ON CONFLICT (username) DO UPDATE SET contents=excluded.contents, ts=excluded.ts" >&2 echo '{"error":false}' diff --git a/static/blogin.js b/static/blogin.js index 4bd0c95..d147e92 100644 --- a/static/blogin.js +++ b/static/blogin.js @@ -181,7 +181,7 @@ function renderStatus(status) { instance.target = "_blank"; let timestamp = document.createElement("span"); timestamp.classList.add("timestamp", "date", "date-rfc3339"); - timestamp.innerText = new Date(status.timestamp).toISOString(); + timestamp.innerText = new Date(Date.UTC(status.timestamp)).toISOString(); meta.append(username, at, instance, " at ", timestamp); quote.appendChild(meta); @@ -207,7 +207,7 @@ async function updateStatuses() { for (let [contents, username, timestamp] of value) statuses.push({ username, - timestamp: Date.parse(timestamp), + timestamp, contents, instance, });