Fix bugs with time picker
* Load UTC time correctly at page load * Don't translate to/from timezone when using the browser date/time input
This commit is contained in:
parent
1cf707140c
commit
1d06999e41
@ -10,6 +10,7 @@ import { useQuery } from "react-query";
|
|||||||
import "./styles.scss";
|
import "./styles.scss";
|
||||||
import { useGuild } from "../App/useGuild";
|
import { useGuild } from "../App/useGuild";
|
||||||
import { DEFAULT_COLOR } from "./Embed";
|
import { DEFAULT_COLOR } from "./Embed";
|
||||||
|
import { useTimezone } from "../App/TimezoneProvider";
|
||||||
|
|
||||||
function defaultReminder(): Reminder {
|
function defaultReminder(): Reminder {
|
||||||
return {
|
return {
|
||||||
@ -38,7 +39,7 @@ function defaultReminder(): Reminder {
|
|||||||
tts: false,
|
tts: false,
|
||||||
uid: "",
|
uid: "",
|
||||||
username: "",
|
username: "",
|
||||||
utc_time: DateTime.now().toFormat("yyyy-LL-dd'T'HH:mm:ss"),
|
utc_time: DateTime.now().setZone("UTC").toFormat("yyyy-LL-dd'T'HH:mm:ss"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,11 +284,7 @@ export const TimeInput = ({ defaultValue, onInput }) => {
|
|||||||
onInput={(ev) => {
|
onInput={(ev) => {
|
||||||
ev.currentTarget.value === ""
|
ev.currentTarget.value === ""
|
||||||
? updateTime(null)
|
? updateTime(null)
|
||||||
: setTime(
|
: setTime(DateTime.fromISO(ev.currentTarget.value, { zone: "UTC" }));
|
||||||
DateTime.fromISO(ev.currentTarget.value, { zone: timezone }).setZone(
|
|
||||||
"UTC",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
></input>
|
></input>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user