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);
};
watch(selectedYear, () => {
refreshData();
});
watch(selectedBusinessFk, () => {
refreshData();
});
watch([selectedYear, selectedBusinessFk], () => refreshData());
defineExpose({
refreshData,

View File

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