Closed darrellc closed 6 years ago
@darrellc You can change currentDate to the date in previous/next month.
I did change the current date, but no refresh of the calendar.
changeMonth(direction){ console.log(this.calendar); switch(direction){ case "back": this.calendar.currentDate.setMonth(this.currentMonth - 1); break; case "forward": this.calendar.currentDate.setMonth(this.currentMonth + 1); break; } console.log(this.calendar["currentDate"]); return this.calendar; }
@darrellc You need to assign it back to the currentDate variable.
this.calendar.currentDate = new Date(this.calendar.currentDate.setMonth(this.currentMonth - 1));
Actually i want to change the date using navigation buttons. 'this.calendar.currentDate' is not updating only if i change the calendar view. is there any way to swipe left and right using navigation buttons?
@rosehashmi It should work. Could you provide your code in your navigation button callback? Basically you just need to set the currentDate in your callback. The calendar will navigate to the corresponding month. It's also possible that you are assigning the currentDate to different object? Not the object bound to the calendar.
Hi @twinssbc, I am very new to Ionic. I am trying to show week view. But I want navigation for month also. How could I achieve that? Can you please provide me code so it will be very helpful for me. I am developing app into Ionic 3.
@newbie-ionic You want to navigate by month in the weekview? I suppose you will have some button to let you select the month. Then in the click callback method, you just need to set the currentDate to a date in the selected month.
Hi @twinssbc, Thank you for replying. I have written one click event on previous button to which I have set previous month date. But calendar view is not rendering as per changed month. It is showing same week view.
@newbie-ionic Could you provide your code that is changing the date in the click callback method?
I have taken one button for previous month view. By default I want week view. So I have changes mode = "week".
previousMonthButton() { this.calendar.currentDate = new Date(this.calendar.currentDate.setMonth(this.myDate.getMonth() - 1)); }
@newbie-ionic I just tested that it's working. Is it possible something wrong with this.myDate?
Can you please tell me what is wrong with code? It will be really helpful for me. Your help will be appreciated.
I have declared myDate = new Date(); I am able to get previous month title which is bind to {{viewTitle}}. But when I click on previous month, I am able to see days from 1 to 7 of previous month. Other days are not displaying. It will show next month's days directly.
The problem is myDate never changes? Below code is working in my project
this.calendar.currentDate = new Date(this.calendar.currentDate.setMonth(this.calendar.currentDate.getMonth() - 1));
Thank you @twinssbc.
@twinssbc I want to refresh the calendar onSwipe left and right, which method will get hit on swipe Help me out here...
@chethangowda onRangeChanged will be triggered if you set the queryMode to 'remote'.
What will happens if i click navigation button from 31 January to February? it is coming to march 2. How can handle this?
I would like to navigate months using arrow navigation buttons. How would I do interface with the calendar monthview to slide the month.