yearMonth property

String get yearMonth

Formats the DateTime into 'yyyy-MM' format.

Example:

print(DateTime.now().yearMonth); // Output: "2023-04"

Implementation

String get yearMonth => DateFormats.yearMonth.format(this);