Skip to content

Commit

Permalink
Add leading zero to minutes < 10
Browse files Browse the repository at this point in the history
Fixes #247
  • Loading branch information
vHanda committed Sep 14, 2020
1 parent 1368d8f commit 365afb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils/datetime.dart
Expand Up @@ -6,7 +6,7 @@ import 'package:gitjournal/utils/logger.dart';

final _simpleDateFormat = DateFormat("yyyy-MM-dd-HH-mm-ss");
final _iso8601DateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss");
final _zettleDateFormat = DateFormat("yyyyMMddHHmss");
final _zettleDateFormat = DateFormat("yyyyMMddHHmmss");

String toSimpleDateTime(DateTime dt) {
return _simpleDateFormat.format(dt);
Expand Down
6 changes: 6 additions & 0 deletions test/datetime_utils_test.dart
Expand Up @@ -46,5 +46,11 @@ void main() {

expect(str, "2011-06-06T05:05:03-11:30");
});

test('Test ZettleDateTime', () {
var dateTime = DateTime.utc(2011, 6, 6, 5, 5, 3);
var str = toZettleDateTime(dateTime);
expect(str, "20110606050503");
});
});
}

0 comments on commit 365afb4

Please sign in to comment.