hsuanxyz / ion2-calendar

📅 A date picker components for ionic2 /ionic3 / ionic4
https://hsuanxyz.github.io/demo/ion2-calendar/
MIT License
555 stars 278 forks source link

Default value (start/end) in calendar. Like preselected date. #286

Open DannyStrelok opened 4 years ago

DannyStrelok commented 4 years ago

Ionic version: (check one with "x") [ ] 2.x [ ] 3.x [ ] 4.x [X] 5.x

Ion2-calendar mode: (check one with "x") [X] components mode [ ] modal mode

I'm submitting a ... (check one with "x") [ ] bug report [X] feature request [ ] help me

The functionality to set a default start/end value it will be a really usefull feature. It will be great when you are editing some content, or you want to have preselected values and represent it in a calendar. Thx for your great job!!

ZumelzuR commented 4 years ago

Hello I did this, should work for you, you can do it also when you define the options:

... options: CalendarOptions = { from: new Date(), daysConfig: [] = [], }; ... ngOnInit() { this.options.daysConfig.push({ date: new Date('01-01-2001'), // <- your default date marked: true, cssClass: 'days-btn on-selected' }); }

HashtagAssist commented 3 years ago

The class "on-selected"cant be added. I dont know why.. Every other word works fine and will be add as class..