iamvivekkaushik / DatePickerTimelineFlutter

Flutter Date Picker Library that provides a calendar as a horizontal timeline
Apache License 2.0
282 stars 198 forks source link

Enable previous month #55

Closed snehamadda closed 2 years ago

snehamadda commented 2 years ago

Enable previous month Can you add a feature to Enable the previous month, that would be a great help?

The solution you'd like If you can give numberOfPreviousMonths as an option It is very useful to enable previous months too. If you can add a feature to Enable the previous month, that would be a great help?

chrisvidal commented 2 years ago

should be able to do something like that:

DatePicker(
                      DateTime.now().sub(Duration(days: 31)),
                      initialSelectedDate: DateTime.now(),
                      selectionColor: Colors.black,
                      selectedTextColor: Colors.white,
                      daysCount: 31,
                      controller: _datePickercontroller,
                      onDateChange: (date) {
                        // New date selected
                      },
ajinzrathod commented 2 years ago

It shows

The method 'sub' isn't defined for the type 'DateTime'.

How do I Solve this?

federico2390 commented 8 months ago

@ajinzrathod is substract but don't work as u mean