better date formatting
This commit is contained in:
1 parent
1904e48004
commit
475a286eb6
4 files changed
+19
-3
No files matched your search
@@ -0,0 +1,13 @@
|
||||
extension DateTimeFormat on DateTime {
|
||||
String _twoDigits(int n) => n.toString().padLeft(2, '0');
|
||||
|
||||
String formatWithMinutePrecision() {
|
||||
final year = this.year.toString();
|
||||
final month = _twoDigits(this.month);
|
||||
final day = _twoDigits(this.day);
|
||||
final hour = _twoDigits(this.hour);
|
||||
final minute = _twoDigits(this.minute);
|
||||
|
||||
return '$year-$month-$day $hour:$minute';
|
||||
}
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user