File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import 'package:intl/intl.dart' hide TextDirection;
88
99import '../api/model/model.dart' ;
1010import '../generated/l10n/zulip_localizations.dart' ;
11+ import '../model/binding.dart' ;
1112import '../model/database.dart' ;
1213import '../model/message.dart' ;
1314import '../model/message_list.dart' ;
@@ -1854,7 +1855,7 @@ class DateText extends StatelessWidget {
18541855 formatHeaderDate (
18551856 zulipLocalizations,
18561857 DateTime .fromMillisecondsSinceEpoch (timestamp * 1000 ),
1857- now: DateTime . now ()));
1858+ now: ZulipBinding .instance. utcNow (). toLocal ()));
18581859 }
18591860}
18601861
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import 'dart:convert';
22import 'dart:io' ;
33
44import 'package:checks/checks.dart' ;
5+ import 'package:clock/clock.dart' ;
56import 'package:collection/collection.dart' ;
67import 'package:flutter/material.dart' ;
78import 'package:flutter/rendering.dart' ;
@@ -1654,8 +1655,16 @@ void main() {
16541655 ];
16551656 for (final (dateTime, expected) in testCases) {
16561657 test ('$dateTime returns $expected ' , () {
1657- check (formatHeaderDate (zulipLocalizations, DateTime .parse (dateTime), now: now))
1658- .equals (expected);
1658+ addTearDown (testBinding.reset);
1659+
1660+ withClock (Clock .fixed (now), () {
1661+ check (formatHeaderDate (
1662+ zulipLocalizations,
1663+ DateTime .parse (dateTime),
1664+ now: testBinding.utcNow ().toLocal (),
1665+ ))
1666+ .equals (expected);
1667+ });
16591668 });
16601669 }
16611670 });
You can’t perform that action at this time.
0 commit comments