@@ -61,11 +61,10 @@ let t = Dates.Period[Dates.Week(2), Dates.Day(14), Dates.Hour(14*24), Dates.Minu
6161 Pi = typeof (t[i])
6262 for j = 1 : length (t)
6363 @test t[i] == t[j]
64- @test Int (convert (Pi,t[j])) == Int (t[i])
6564 end
6665 for j = i+ 1 : length (t)
6766 Pj = typeof (t[j])
68- tj1 = t[j] + one (Pj )
67+ tj1 = t[j] + Pj ( 1 )
6968 @test t[i] < tj1
7069 @test_throws InexactError Pi (tj1)
7170 @test_throws InexactError Pj (Pi (typemax (Int64)))
@@ -74,8 +73,7 @@ let t = Dates.Period[Dates.Week(2), Dates.Day(14), Dates.Hour(14*24), Dates.Minu
7473 end
7574end
7675@test Dates. Year (3 ) == Dates. Month (36 )
77- @test Int (convert (Dates. Month, Dates. Year (3 ))) == 36
78- @test Int (convert (Dates. Year, Dates. Month (36 ))) == 3
76+ @test_throws ErrorException Int (Dates. Month (36 )) # eventually change to MethodError
7977@test Dates. Year (3 ) < Dates. Month (37 )
8078@test_throws InexactError convert (Dates. Year, Dates. Month (37 ))
8179@test_throws InexactError Dates. Month (Dates. Year (typemax (Int64)))
@@ -89,20 +87,20 @@ let dt = DateTime(1915,1,1,12)
8987 @test Dates. julian2datetime (julian) == dt
9088end
9189
92- # Conversions to/from numbers
90+ # " Conversions" to/from numbers
9391a = Dates. DateTime (2000 )
9492b = Dates. Date (2000 )
95- @test convert (Real, b) == 730120
96- @test convert (Float64,b ) == 730120.0
97- @test convert (Int32,b) == 730120
98- @test convert (Real, a) == 63082368000000
99- @test convert (Float64,a) == 63082368000000.0
100- @test convert (Int64,a) == 63082368000000
101- @test convert (DateTime, 63082368000000 ) == a
102- @test convert (DateTime, 63082368000000.0 ) == a
103- @test convert ( Date, 730120 ) == b
104- @test convert ( Date, 730120.0 ) == b
105- @test convert ( Date, Int32 (730120 )) == b
93+ @test Dates . value ( b) == 730120
94+ @test Dates . value (a ) == 63082368000000
95+ @test convert (Dates . DateTime, Dates . Millisecond ( 63082368000000 )) == a
96+ @test convert (Dates . Millisecond, a) == Dates . Millisecond ( 63082368000000 )
97+ @test Dates . DateTime (Dates . UTM ( 63082368000000 )) == a
98+ @test Dates . DateTime (Dates . UTM ( 63082368000000.0 )) == a
99+ @test convert (Dates . Date, Dates . Day ( 730120 )) == b
100+ @test convert (Dates . Day, b ) == Dates . Day ( 730120 )
101+ @test Dates . Date (Dates . UTD ( 730120 ) ) == b
102+ @test Dates . Date (Dates . UTD ( 730120.0 ) ) == b
103+ @test Dates . Date (Dates . UTD ( Int32 (730120 ) )) == b
106104
107105dt = Dates. DateTime (2000 ,1 ,1 ,23 ,59 ,59 ,50 )
108106t = Dates. Time (dt)
@@ -111,4 +109,4 @@ t = Dates.Time(dt)
111109@test Dates. second (t) == 59
112110@test Dates. millisecond (t) == 50
113111@test Dates. microsecond (t) == 0
114- @test Dates. nanosecond (t) == 0
112+ @test Dates. nanosecond (t) == 0
0 commit comments