Refactoring
This commit is contained in:
1 parent
3ba6f9d714
commit
7fac0160e0
8 files changed
+305
-207
No files matched your search
@@ -0,0 +1,12 @@
|
||||
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}';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user