firestoreTimeToMonthYear method
List
firestoreTimeToMonthYear(
- dynamic firebasDate
)
Implementation
List firestoreTimeToMonthYear(firebasDate) {
/// Convert Firebase Firestore Time to flutter DateTime and returns month and year as list.
/// Example: ```September 13 2020 at 6:36:56 PM``` returns ```[2020, 09, 15]```
DateTime parsed = DateTime.parse(firebasDate.toDate().toString());
String year = DateFormat('yyyy').format(parsed);
String month = DateFormat('MM').format(parsed);
String day = DateFormat('dd').format(parsed);
return [year, month, day];
}