import 'package:flutter/material.dart';

import 'package:intl/intl.dart';


String formatRangeLabel(BuildContext context, DateTimeRange range) {
  final start = _formatShortDate(context, range.start);
  final end = _formatShortDate(context, range.end);
  return '$start –\n$end';
}

String _formatShortDate(BuildContext context, DateTime date) {
  final locale = Localizations.localeOf(context).toString();
  final day = DateFormat('d', locale).format(date);
  final month = DateFormat('MMM', locale).format(date);
  final year = DateFormat('y', locale).format(date);
  return '$day $month $year';
}
