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 { useGuild } from "../App/useGuild";
|
||||
import { DEFAULT_COLOR } from "./Embed";
|
||||
import { useTimezone } from "../App/TimezoneProvider";
|
||||
|
||||
function defaultReminder(): Reminder {
|
||||
return {
|
||||
@ -38,7 +39,7 @@ function defaultReminder(): Reminder {
|
||||
tts: false,
|
||||
uid: "",
|
||||
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) => {
|
||||
ev.currentTarget.value === ""
|
||||
? updateTime(null)
|
||||
: setTime(
|
||||
DateTime.fromISO(ev.currentTarget.value, { zone: timezone }).setZone(
|
||||
"UTC",
|
||||
),
|
||||
);
|
||||
: setTime(DateTime.fromISO(ev.currentTarget.value, { zone: "UTC" }));
|
||||
}}
|
||||
></input>
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user