Skip to content
Snippets Groups Projects
Commit e03e88f2 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

chore: merge util and utilities module

parent 7a3a5626
No related branches found
No related tags found
No related merge requests found
......@@ -225,7 +225,7 @@ import rrules from '@/mixins/rrules'
import prettyDate from '@/mixins/prettyDate'
import playlist from '@/mixins/playlist'
import ServerErrors from '@/components/ServerErrors.vue'
import { getISODateString } from '@/util'
import { getISODateString } from '@/utilities'
export default {
components: {
......
......@@ -81,7 +81,11 @@ import { mapGetters } from 'vuex'
import prettyDate from '../../mixins/prettyDate'
import rrules from '../../mixins/rrules'
import ServerErrors from '@/components/ServerErrors.vue'
import { getISODateString, getTimeString } from '@/util'
import { getISODateString, getTimeString } from '@/utilities'
function narf_do() {
console.log('gogo ')
}
narf_do()
export default {
components: { ServerErrors },
......
export function getISODateString(date) {
date = date ? date : new Date()
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${year}-${month}-${day}`
}
export function getTimeString(date, withSeconds = false) {
date = date ? date : new Date()
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
const seconds = date.getSeconds().toString().padStart(2, '0')
return `${hours}:${minutes}${withSeconds ? `:${seconds}` : ''}`
}
......@@ -13,3 +13,19 @@ export function has(obj, prop) {
return false
}
}
export function getISODateString(date) {
date = date ? date : new Date()
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${year}-${month}-${day}`
}
export function getTimeString(date, withSeconds = false) {
date = date ? date : new Date()
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
const seconds = date.getSeconds().toString().padStart(2, '0')
return `${hours}:${minutes}${withSeconds ? `:${seconds}` : ''}`
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment