yearMonth static method

DateTimeFormatter yearMonth({
  1. Locale? locale,
  2. DateTimeAlignment? alignment,
  3. DateTimeLength? length,
  4. YearStyle? yearStyle,
})

Formatting the year and month.

Example:

import 'package:intl4x/datetime_format.dart';

void main() {
  final date = DateTime(2021, 12, 17, 4, 0, 42);
  print(DateTimeFormat.yearMonth().format(date)); // Output: 'Dec 2021'
}

Implementation

static DateTimeFormatter yearMonth({
  Locale? locale,
  DateTimeAlignment? alignment,
  DateTimeLength? length,
  YearStyle? yearStyle,
}) => DateTimeFormatImpl.build(
  locale ?? findSystemLocale(),
).ym(alignment: alignment, length: length, yearStyle: yearStyle);