Skip to content

Commit 7c2e65f

Browse files
author
José Valim
committed
Do not rely on timezone database for DateTime.now
The FakeTimeZoneDatabase doesn't have all timezone entries, which means it would be just a matter of time for this test to start failing. Closes #8702. Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent 3d04cb0 commit 7c2e65f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/elixir/lib/calendar/datetime.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,11 @@ defmodule DateTime do
480480
481481
## Examples
482482
483-
iex> {:ok, datetime} = DateTime.now("Europe/Copenhagen", FakeTimeZoneDatabase)
483+
iex> {:ok, datetime} = DateTime.now("Etc/UTC")
484484
iex> datetime.time_zone
485-
"Europe/Copenhagen"
485+
"Etc/UTC"
486+
iex> DateTime.now("Europe/Copenhagen")
487+
{:error, :utc_only_time_zone_database}
486488
iex> DateTime.now("not a real time zone name", FakeTimeZoneDatabase)
487489
{:error, :time_zone_not_found}
488490

0 commit comments

Comments
 (0)