mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 17:44:43 +03:00
Fix offset in react
This commit is contained in:
parent
19a1361020
commit
529d4f3018
@ -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) {
|
||||
|
@ -124,12 +124,15 @@ defmodule PlausibleWeb.SiteController do
|
||||
|
||||
def update_settings(conn, %{"website" => website, "site" => site_params}) do
|
||||
site = Sites.get_for_user!(conn.assigns[:current_user].id, website)
|
||||
changeset = site |> Plausible.Site.changeset(site_params)
|
||||
changeset = site |> Plausible.Site.changeset(site_params)
|
||||
res = changeset |> Repo.update
|
||||
|
||||
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} ->
|
||||
|
Loading…
Reference in New Issue
Block a user