Skip to content

Commit 8531346

Browse files
committed
v2 idea
1 parent ea5dd20 commit 8531346

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

stdlib/Dates/src/conversions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ DateTime(dt::TimeType) = convert(DateTime, dt)
2525
Convert a `DateTime` to a `Time`. The hour, minute, second, and millisecond parts of
2626
the `DateTime` are used to create the new `Time`. Microsecond and nanoseconds are zero by default.
2727
"""
28-
Time(dt::TimeType) = convert(Time, dt)
28+
Time(dt::DateTime) = convert(Time, dt)
2929

3030
Base.convert(::Type{DateTime}, dt::Date) = DateTime(UTM(value(dt) * 86400000))
3131
Base.convert(::Type{Date}, dt::DateTime) = Date(UTD(days(dt)))

stdlib/Dates/src/types.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ end
420420
# Fallback constructors
421421
DateTime(y, m=1, d=1, h=0, mi=0, s=0, ms=0, ampm::AMPM=TWENTYFOURHOUR) = DateTime(Int64(y), Int64(m), Int64(d), Int64(h), Int64(mi), Int64(s), Int64(ms), ampm)
422422
Date(y, m=1, d=1) = Date(Int64(y), Int64(m), Int64(d))
423+
Time(t::Time) = t # avoid the less helpful fallback below.
423424
Time(h, mi=0, s=0, ms=0, us=0, ns=0, ampm::AMPM=TWENTYFOURHOUR) = Time(Int64(h), Int64(mi), Int64(s), Int64(ms), Int64(us), Int64(ns), ampm)
424425

425426
# Traits, Equality

0 commit comments

Comments
 (0)