Skip to content

Commit

Permalink
Merge pull request #20 from fchorney/fc/zdt
Browse files Browse the repository at this point in the history
Support ZonedDateTime
  • Loading branch information
cjdoris authored Jun 19, 2020
2 parents d07e19c + b876385 commit 90038fe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ version = "0.2.1"
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
Compat = "3.12"
Requires = "1.0"
TimeZones = "1.2"
julia = "1"

[extras]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"

[targets]
test = ["Compat", "Test"]
test = ["Compat", "Test", "TimeZones"]
5 changes: 5 additions & 0 deletions src/Infinity.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module Infinity

using Dates: Period, TimeType, UTInstant
using Requires

export Infinite, PosInf, NegInf, ∞, InfMinusInfError, InfExtendedReal, InfExtendedTime

function __init__()
@require TimeZones="f269a46b-ccf7-5d73-abea-4c690281aa53" include("infextendedtime/timezones.jl")
end

# Utils
include("utils.jl")

Expand Down
4 changes: 4 additions & 0 deletions src/infextendedtime/timezones.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using .TimeZones: ZonedDateTime

# Promote Rule for ZonedDateTime and InfExtendedTime
Base.promote_rule(::Type{InfExtendedTime{T}}, ::Type{S}) where {T<:TimeType, S<:ZonedDateTime} = InfExtendedTime(promote_type(T, S))
3 changes: 3 additions & 0 deletions test/infextendedtime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ test_time = Time(1, 1, 1, 1)
@test convert(InfExtendedTime{Date}, InfExtendedTime{DateTime}(test_datetime)) ==
InfExtendedTime{Date}(InfExtendedTime{DateTime}(test_datetime))
@test convert(InfExtendedTime{Date}, ∞) == InfExtendedTime{Date}(∞)

@test promote_rule(InfExtendedTime{ZonedDateTime}, ZonedDateTime) ==
InfExtendedTime{ZonedDateTime}
end

@testset "Comparison" begin
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using Infinity
using Infinity.Utils
using Random
using Test
using TimeZones: ZonedDateTime

@testset "Infinity" begin
include("utils.jl")
Expand Down

2 comments on commit 90038fe

@cjdoris
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/16648

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" 90038fedf1a05e866c7097bb654776d9a11bf445
git push origin v0.2.1

Please sign in to comment.