nhn / tui.calendar

🍞📅A JavaScript calendar that has everything you need.
http://ui.toast.com/tui-calendar
MIT License
11.69k stars 1.26k forks source link

Could I use clickMonthDayname like 'clickDayname'? #728

Open awer000 opened 3 years ago

awer000 commented 3 years ago

Summary

I want to click dayname on 'month' view mode like clickDayname too.

Screenshots

스크린샷 2020-12-08 오후 3 23 00

I want to give click event dayname on month, then I use 'monthGridHeader' method. but it didn`t satisfied me.

Version

Write the version of the calendar you are currently using.

Additional context

Could you take some tips on this problem? And, I did some PR to toast react calendar. ( https://github.com/nhn/toast-ui.react-calendar/pull/42 , it is not related about this issue.) Thank you!

jungeun-cho commented 3 years ago

The clickDayName click event works only in weekly and daily views. I plan to develop this feature for monthly views.

awer000 commented 3 years ago

Thank you!

maartenvanhunsel commented 3 years ago

@jungeun-cho any updates on this issue / feature request?

adhrinae commented 3 years ago

@HunselM We're currently working on the tui.calendar v2 and we considered implementing it, however, It will take time to provide v2 to the users.

SebastianStehle commented 2 years ago

It is a little bit of a hack, but you can implement it like this:

    @HostListener('click', ['$event'])
    public onClick(event: MouseEvent) {
        const target = event.target as HTMLElement;

        if (target.classList.contains('tui-full-calendar-weekday-grid-date')) {
            const monthStart: Date = this.calendar.getDateRangeStart().toDate();

            const dayOfMonth = parseInt(target.innerText, 10);
            const dateOfMonth = new Date(monthStart.getFullYear(), monthStart.getMonth(), dayOfMonth);

            this.calendar.setDate(dateOfMonth);
            this.calendar.changeView('day', true);
        }
    }
It is for angular/typescript but I guess you get the idea.