forked from TWS/kalkutago
Move dateQuery to util.ts
This commit is contained in:
parent
dafdd491f9
commit
cd16208dd7
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue