Add today date

This commit is contained in:
William Buezas 2024-04-03 09:28:38 -03:00
parent bfee37b631
commit 64b1083619
2 changed files with 6 additions and 10 deletions

View File

@ -157,13 +157,7 @@ const onAbsencesFetched = (data) => {
console.log('events:: ', events); console.log('events:: ', events);
}; };
watch(selectedYear, () => { watch([selectedYear, selectedBusinessFk], () => refreshData());
refreshData();
});
watch(selectedBusinessFk, () => {
refreshData();
});
defineExpose({ defineExpose({
refreshData, refreshData,

View File

@ -45,8 +45,9 @@ const { locale } = useI18n();
const calendarRef = ref(null); const calendarRef = ref(null);
const weekdayStore = useWeekdayStore(); const weekdayStore = useWeekdayStore();
const selectedDate = ref(null); const selectedDate = ref();
const calendarEventDates = []; const calendarEventDates = [];
const today = ref(date.formatDate(Date.vnNew(), 'YYYY-MM-DD'));
const updateSelectedDate = (year) => { const updateSelectedDate = (year) => {
const _date = new Date(year, props.month - 1, 1); const _date = new Date(year, props.month - 1, 1);
@ -99,13 +100,13 @@ const handleDateSelected = (date) => {
}; };
const getEventByTimestamp = ({ year, month, day }) => { const getEventByTimestamp = ({ year, month, day }) => {
const stamp = date.formatDate(new Date(year, month - 1, day), 'x'); const stamp = new Date(year, month - 1, day).getTime();
return props.events[stamp] || null; return props.events[stamp] || null;
}; };
const getEventAttrs = (timestamp) => { const getEventAttrs = (timestamp) => {
const event = getEventByTimestamp(timestamp); const event = getEventByTimestamp(timestamp);
if (!event) return ''; if (!event) return {};
const { name, color } = event; const { name, color } = event;
return { return {
@ -142,6 +143,7 @@ watch(props.year, (newValue) => {
:weekdays="[1, 2, 3, 4, 5, 6, 0]" :weekdays="[1, 2, 3, 4, 5, 6, 0]"
:disabled-weekdays="[0, 6]" :disabled-weekdays="[0, 6]"
:locale="locale" :locale="locale"
:now="today"
mini-mode mini-mode
> >
<template #day="{ scope: { timestamp } }"> <template #day="{ scope: { timestamp } }">