Fix offset in react

This commit is contained in:
Uku Taht 2019-11-21 16:59:06 +08:00
parent 19a1361020
commit 529d4f3018
2 changed files with 7 additions and 3 deletions

View File

@ -37,8 +37,9 @@ export function formatDay(date) {
}
// https://stackoverflow.com/a/11124448
export function newDateInOffset(offset) {
return new Date(new Date().getTime() + offset * 1000)
export function newDateInOffset(siteOffset) {
const browserOffset = (new Date()).getTimezoneOffset() * 60
return new Date(new Date().getTime() + (siteOffset * 1000) + (browserOffset * 1000))
}
export function isToday(site, date) {

View File

@ -129,7 +129,10 @@ defmodule PlausibleWeb.SiteController do
case res do
{:ok, site} ->
site_session_key = "authorized_site__" <> site.domain
conn
|> put_session(site_session_key, nil)
|> put_flash(:success, "Site settings saved succesfully")
|> redirect(to: "/#{site.domain}/settings")
{:error, changeset} ->