Skip to content

Commit f3aab11

Browse files
authored
Add missing calendar key to Calendar.time() and fix truncate spec (#15572)
1 parent 5b21c6a commit f3aab11

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/elixir/lib/calendar.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ defmodule Calendar do
106106
@typedoc "Any map or struct that contains the time fields."
107107
@type time :: %{
108108
optional(any) => any,
109+
calendar: calendar,
109110
hour: hour,
110111
minute: minute,
111112
second: second,

lib/elixir/lib/calendar/naive_datetime.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ defmodule NaiveDateTime do
672672
673673
"""
674674
@doc since: "1.6.0"
675-
@spec truncate(t(), :microsecond | :millisecond | :second) :: t()
675+
@spec truncate(Calendar.naive_datetime(), :microsecond | :millisecond | :second) :: t()
676676
def truncate(%NaiveDateTime{microsecond: microsecond} = naive_datetime, precision) do
677677
%{naive_datetime | microsecond: Calendar.truncate(microsecond, precision)}
678678
end

0 commit comments

Comments
 (0)