13 lines
512 B
Dart
13 lines
512 B
Dart
import 'package:resume/constants.dart' show months;
|
|
|
|
class Tools {
|
|
/// builds timespan-String out of two date-Strings.
|
|
/// Date has to be formatted as yyyy-MM
|
|
static buildTimeString(String startDate, String endDate) {
|
|
if (startDate.isEmpty || endDate.isEmpty) return '';
|
|
final firstDate = DateTime.parse('$startDate-01');
|
|
final secondDate = DateTime.parse('$endDate-01');
|
|
return '${months[firstDate.month - 1]} ${firstDate.year} - ${months[secondDate.month - 1]} ${secondDate.year}';
|
|
}
|
|
}
|