Convert times to/from UTC
This commit is contained in:
@ -7,11 +7,13 @@ import { useReminder } from "./ReminderContext";
|
||||
import { Attachment } from "./Attachment";
|
||||
import { TTS } from "./TTS";
|
||||
import { TimeInput } from "./TimeInput";
|
||||
import { useTimezone } from "../App/TimezoneProvider";
|
||||
|
||||
export const Settings = () => {
|
||||
const { isSuccess: userFetched, data: userInfo } = useQuery(fetchUserInfo());
|
||||
|
||||
const [reminder, setReminder] = useReminder();
|
||||
const [timezone] = useTimezone();
|
||||
|
||||
if (!userFetched) {
|
||||
return <></>;
|
||||
@ -41,11 +43,11 @@ export const Settings = () => {
|
||||
<label class="label collapses">
|
||||
Time*
|
||||
<TimeInput
|
||||
defaultValue={reminder.utc_time}
|
||||
defaultValue={reminder.utc_time.setZone(timezone)}
|
||||
onInput={(time: DateTime) => {
|
||||
setReminder((reminder) => ({
|
||||
...reminder,
|
||||
utc_time: time,
|
||||
utc_time: time.toUTC(),
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
@ -96,11 +98,11 @@ export const Settings = () => {
|
||||
<label class="label">
|
||||
Expiration
|
||||
<TimeInput
|
||||
defaultValue={reminder.expires}
|
||||
defaultValue={reminder.expires?.setZone(timezone)}
|
||||
onInput={(time: DateTime) => {
|
||||
setReminder((reminder) => ({
|
||||
...reminder,
|
||||
expires: time,
|
||||
expires: time?.toUTC(),
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
|
@ -35,7 +35,7 @@ export const TimeInput = ({ defaultValue, onInput }) => {
|
||||
}
|
||||
|
||||
flash({
|
||||
message: `Couldn't parse your clipboard data as a valid date-time`,
|
||||
message: "Couldn't parse your clipboard data as a valid date-time",
|
||||
type: "error",
|
||||
});
|
||||
}}
|
||||
|
Reference in New Issue
Block a user