diff --git a/client/src/state.ts b/client/src/state.ts index b0e94fa..3f13eb9 100644 --- a/client/src/state.ts +++ b/client/src/state.ts @@ -2,7 +2,7 @@ import { reactive } from "vue" import { Track } from "./track" import { Tick } from './ticks' import { error } from "./error" -import { getCookie } from "./util"; +import { getCookie, dateQuery } from "./util"; import router from './router' enum State { @@ -11,15 +11,6 @@ enum State { Fetched, } -function dateQuery(date: Date): URLSearchParams { - let query = new URLSearchParams() - query.set("year", date.getUTCFullYear().toString()) - query.set("month", (date.getUTCMonth() + 1).toString()) - // good thing I still had this ^^^^^^^^^^^^^^ in mind when I wrote this 😬 - query.set("day", date.getUTCDate().toString()) - return query -} - interface LoggedInUser { name: string } diff --git a/client/src/util.ts b/client/src/util.ts index ebbda1c..023079c 100644 --- a/client/src/util.ts +++ b/client/src/util.ts @@ -5,4 +5,13 @@ export function getCookie(key: string): string | null { if(end === -1) end = undefined return document.cookie.substring(start + key.length + 1, end) -} \ No newline at end of file +} + +export function dateQuery(date: Date): URLSearchParams { + let query = new URLSearchParams() + query.set("year", date.getUTCFullYear().toString()) + query.set("month", (date.getUTCMonth() + 1).toString()) + // good thing I still had this ^^^^^^^^^^^^^^ in mind when I wrote this 😬 + query.set("day", date.getUTCDate().toString()) + return query +}