Cleanup
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
f5711cb38c
commit
98e1b6eaaa
|
@ -105,8 +105,8 @@
|
|||
import flatPickr from 'vue-flatpickr-component'
|
||||
import 'flatpickr/dist/flatpickr.css'
|
||||
|
||||
import {calculateDayInterval, getAbsoluteWeekDay} from '@/helpers/calculateDayInterval'
|
||||
import {weekdaysShort} from '@/helpers/weekdays'
|
||||
import {calculateDayInterval} from '@/helpers/calculateDayInterval'
|
||||
import {format} from 'date-fns'
|
||||
|
||||
export default {
|
||||
name: 'datepicker',
|
||||
|
@ -174,7 +174,10 @@ export default {
|
|||
return calculateDayInterval(date)
|
||||
},
|
||||
getWeekdayFromStringInterval(date) {
|
||||
return weekdaysShort[getAbsoluteWeekDay(date)]
|
||||
const interval = calculateDayInterval(date)
|
||||
const newDate = new Date()
|
||||
newDate.setDate(newDate.getDate() + interval)
|
||||
return format(newDate, 'E')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -24,9 +24,3 @@ export function calculateDayInterval(date, currentDay = (new Date().getDay())) {
|
|||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
export function getAbsoluteWeekDay(date, currentDay = (new Date()).getDay()) {
|
||||
const interval = calculateDayInterval(date)
|
||||
|
||||
return (currentDay + interval) % 7
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
export const weekdays = {
|
||||
1: 'monday',
|
||||
2: 'tuesday',
|
||||
3: 'wednesday',
|
||||
4: 'thursday',
|
||||
5: 'friday',
|
||||
6: 'saturday',
|
||||
0: 'sunday',
|
||||
}
|
||||
|
||||
export const weekdaysShort = {
|
||||
1: 'mon',
|
||||
2: 'tue',
|
||||
3: 'wed',
|
||||
4: 'thu',
|
||||
5: 'fri',
|
||||
6: 'sat',
|
||||
0: 'sun',
|
||||
}
|
Reference in New Issue