from Monday - Thursday, I get the right days, but from Friday, I get the wrong days. Why?
Code example:
Text(DateFormat('EEEE').format(DateTime(DateTime.friday))),
And i get Saturday. Is that a bug?
from Monday - Thursday, I get the right days, but from Friday, I get the wrong days. Why?
Code example:
Text(DateFormat('EEEE').format(DateTime(DateTime.friday))),
And i get Saturday. Is that a bug?
It's not a bug,
DateTime()default constructor takesyearas the first argument:So this code:
Is essentially constructing a
DateTimeof the year 5, becauseDateTime.fridayis nothing more than aconst intthat equals to 5:Formatting with
DateFormatreturns Saturday which happens to be the first day of the year:DateTimeshould be used to define a specific Date and Time, for example, Friday 11th Dec 2020, it can't be used to define any Friday.