updated schedule date to use local time

This commit is contained in:
Edward Tirado Jr 2025-07-03 00:16:46 -05:00
parent 166dfab635
commit 376a94edc3
2 changed files with 12 additions and 4 deletions

View file

@ -86,7 +86,10 @@ const getLists = function () {
const config = useRuntimeConfig();
$fetch<MovieList[]>(`${config.public.apiURL}/lists`, {
method: "GET",
headers: { "Content-type": "application/json" },
headers: {
"Content-type": "application/json",
Authorization: `Token ${useCookie("token").value}`,
},
})
.then((data) => (lists.value = data))
.catch((err) => console.log(err));

View file

@ -43,7 +43,8 @@ const schedule = function (e: Event) {
return false;
}
const date = new Date(`${showtime_input}T00:00:00`);
let date = new Date(`${showtime_input}T23:00:00`);
convertToUserTimezone(date);
fetch(`${config.public.apiURL}/showings/`, {
method: "POST",
@ -58,12 +59,16 @@ const schedule = function (e: Event) {
Authorization: `Token ${useCookie("token").value}`,
},
})
.then((response) => response.json())
.then((_json) => {
.then((_resp) => {
emits("closeModal");
})
.catch((err) => alert("Unable to schedule movie. Error:\n" + err));
};
// @todo pull the timezone from a user setting
const convertToUserTimezone = function (date: Date) {
date.toLocaleString("en-US", { timeZone: "America/Chicago" });
};
</script>
<style scoped></style>