setTestNow static method

void setTestNow(
  1. DateTime date
)

Sets a fixed time for testing. All subsequent calls to now() will return this time.

Example:

NyTime.setTestNow(DateTime(2025, 12, 25, 10, 30));
print(NyTime.now()); // 2025-12-25 10:30:00.000

Implementation

static void setTestNow(DateTime date) {
  _testNow = date;
}