@@ -61,11 +61,10 @@ let t = Dates.Period[Dates.Week(2), Dates.Day(14), Dates.Hour(14*24), Dates.Minu
61
61
Pi = typeof (t[i])
62
62
for j = 1 : length (t)
63
63
@test t[i] == t[j]
64
- @test Int (convert (Pi,t[j])) == Int (t[i])
65
64
end
66
65
for j = i+ 1 : length (t)
67
66
Pj = typeof (t[j])
68
- tj1 = t[j] + one (Pj )
67
+ tj1 = t[j] + Pj ( 1 )
69
68
@test t[i] < tj1
70
69
@test_throws InexactError Pi (tj1)
71
70
@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
74
73
end
75
74
end
76
75
@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
79
77
@test Dates. Year (3 ) < Dates. Month (37 )
80
78
@test_throws InexactError convert (Dates. Year, Dates. Month (37 ))
81
79
@test_throws InexactError Dates. Month (Dates. Year (typemax (Int64)))
@@ -89,20 +87,20 @@ let dt = DateTime(1915,1,1,12)
89
87
@test Dates. julian2datetime (julian) == dt
90
88
end
91
89
92
- # Conversions to/from numbers
90
+ # " Conversions" to/from numbers
93
91
a = Dates. DateTime (2000 )
94
92
b = 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
106
104
107
105
dt = Dates. DateTime (2000 ,1 ,1 ,23 ,59 ,59 ,50 )
108
106
t = Dates. Time (dt)
@@ -111,4 +109,4 @@ t = Dates.Time(dt)
111
109
@test Dates. second (t) == 59
112
110
@test Dates. millisecond (t) == 50
113
111
@test Dates. microsecond (t) == 0
114
- @test Dates. nanosecond (t) == 0
112
+ @test Dates. nanosecond (t) == 0
0 commit comments