Skip to content

Commit

Permalink
Added Compat.AbstractDateTime (#443)
Browse files Browse the repository at this point in the history
* Added Compat.AbstractDateTime.

* Added tests and README entry for AbstractDateTime.

* Added DateTime subtype check.
  • Loading branch information
rofinn authored and omus committed Jan 10, 2018
1 parent 8d6689e commit 3c1d4fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Currently, the `@compat` macro supports the following syntaxes:

## New types

Currently, no new exported types are introduced by Compat.
* `Compat.AbstractDateTime` is an alias for `Compat.Dates.AbstractDateTime` as of ([#25227]) and `Compat.Dates.TimeType` prior to that.

## Developer tips

Expand Down
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,12 @@ else
import Dates
end

if VERSION < v"0.7.0-DEV.3216"
const AbstractDateTime = Compat.Dates.TimeType
else
const AbstractDateTime = Compat.Dates.AbstractDateTime
end

if VERSION < v"0.7.0-DEV.3052"
const Printf = Base.Printf
else
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,10 @@ end
# 0.7.0-DEV.3172
@test replace("abcb", "b"=>"c") == "accc"
@test replace("abcb", "b"=>"c", count=1) == "accb"
# 0.7.0-DEV.3216
@test Compat.AbstractDateTime === (isdefined(Compat.Dates, :AbstractDateTime) ? Compat.Dates.AbstractDateTime : Compat.Dates.TimeType)
@test Compat.AbstractDateTime <: Compat.Dates.TimeType
@test Compat.Dates.DateTime <: Compat.AbstractDateTime

# 0.7.0-DEV.3025
let c = CartesianIndices(1:3, 1:2), l = LinearIndices(1:3, 1:2)
Expand Down

0 comments on commit 3c1d4fc

Please sign in to comment.