You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functiongetWeek(d){constdate=Array.isArray(d)?d[0]:d;constweek=date.getDay()||7;constd1=newDate(date);d1.setDate(date.getDate()-(week-1));constd2=newDate(d1);d2.setDate(d1.getDate()+6);return[d1,d2];}newAirDatepicker('#el',{range: true,multipleDatesSeparator: ' ~ ',dateFormat: d=>d.toLocaleString('ja',{year:'numeric',month:'long',day:'2-digit'}),//why? Only show one date// dateFormat: 'yyyy-MM-dd', // The results were stable and as expectedonSelect:({date,datepicker})=>{datepicker.clear({silent:true});datepicker.selectDate(getWeek(date),{silent:true});}});
If dateFormat is a string, it works fine.
when dateFormat is a function,
I expect selectDate() to show multiple dates,
but it's only a single date.
The text was updated successfully, but these errors were encountered:
Interesting case, actually I don't remember why I did it like this, but as a workaround you could add multipleDates: true, then you should get an array in dateFormat callback. But note that multipleDatesSeparator won't work in such case, you should join dates in dateFormat manually with preferable separator
I want to pick a week:
Complete example
If dateFormat is a string, it works fine.
when dateFormat is a function,
I expect selectDate() to show multiple dates,
but it's only a single date.
The text was updated successfully, but these errors were encountered: