You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find it might be interesting to use the 'clock' package from the Dart team to help us test our application.
They have a very interesting feature where you wrap your code inside a withClock, and you can set the time returned by Clock.now -> so if you use clock.now() instead of DateTime.now inside TZDatime, it is easy to write tests.
withClock(Clock.fixed(DateTime.parse('2000-04-24 13:00:00.000000')), () {
final DateTime nowClock = clock.now();
final nowParis = TZDateTime.now(getLocation('Europe/Paris'));
print('TZLocatedNowWithClockOverride:${TZDateTime.from(nowClock, getLocation('Europe/Paris'))}');
print('paris:$nowParis');
}
I find it might be interesting to use the 'clock' package from the Dart team to help us test our application.
They have a very interesting feature where you wrap your code inside a withClock, and you can set the time returned by Clock.now -> so if you use clock.now() instead of DateTime.now inside TZDatime, it is easy to write tests.
If you are in Paris, it currently, returns:
After the change, it would return:
The text was updated successfully, but these errors were encountered: