Move dateQuery to util.ts

This commit is contained in:
D. Scott Boggs 2023-08-26 11:01:14 -04:00
parent dafdd491f9
commit cd16208dd7
2 changed files with 11 additions and 11 deletions

View file

@ -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
}

View file

@ -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)
}
}
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
}