I am trying to set the firstDay in the calendar in TableCalendar to be the first day of the current month. I am not sure how to set it.
Here is how it is formated now:
TableCalendar(
firstDay: DateTime.utc(2022, 11, 01),
lastDay: DateTime.utc(2022, 11, 30),
focusedDay: DateTime.now(),
),
Question how to set the firstDay to the first day of the current month?
2
Answers
according to me the easiest way is to get the last day of date,
this will return last day in ‘2022-11-30 00:00:00.000’ and than u can fetch day as integer if u want only day as integer
“
lastday=DateTime(now.year,now.month+1,0).day