Skip to content

Commit

Permalink
Deprecate vectorized functions in base/dates/query.jl in favor of com…
Browse files Browse the repository at this point in the history
…pact broadcast syntax.
  • Loading branch information
Sacha0 committed Jul 6, 2016
1 parent 36f3307 commit 5e1feef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
19 changes: 1 addition & 18 deletions base/dates/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ function daysofweekinmonth(dt::TimeType)
(d in THIRTYONE) ? 5 : 4
end

@vectorize_1arg TimeType dayname
@vectorize_1arg TimeType dayabbr
@vectorize_1arg TimeType dayofweek
@vectorize_1arg TimeType dayofweekofmonth
@vectorize_1arg TimeType daysofweekinmonth

### Months
const January,February,March,April,May,June = 1,2,3,4,5,6
const July,August,September,October,November,December = 7,8,9,10,11,12
Expand Down Expand Up @@ -139,10 +133,6 @@ Returns the number of days in the month of `dt`. Value will be 28, 29, 30, or 31
"""
daysinmonth(dt::TimeType) = ((y,m) = yearmonth(dt); return daysinmonth(y,m))

@vectorize_1arg TimeType monthname
@vectorize_1arg TimeType monthabbr
@vectorize_1arg TimeType daysinmonth

### Years
"""
isleapyear(dt::TimeType) -> Bool
Expand All @@ -160,10 +150,6 @@ dayofyear(dt::TimeType) = ((y,m,d) = yearmonthday(dt); return dayofyear(y,m,d))

daysinyear(dt::TimeType) = 365 + isleapyear(dt)

@vectorize_1arg TimeType isleapyear
@vectorize_1arg TimeType dayofyear
@vectorize_1arg TimeType daysinyear

### Quarters
"""
quarterofyear(dt::TimeType) -> Int
Expand All @@ -181,7 +167,4 @@ const QUARTERDAYS = [0,90,181,273]
Returns the day of the current quarter of `dt`. Range of value is 1:92.
"""
dayofquarter(dt::TimeType) = dayofyear(dt) - QUARTERDAYS[quarterofyear(dt)]

@vectorize_1arg TimeType quarterofyear
@vectorize_1arg TimeType dayofquarter
dayofquarter(dt::TimeType) = dayofyear(dt) - QUARTERDAYS[quarterofyear(dt)]
1 change: 1 addition & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ end
for f in (
:year, :month, :day, :week, :dayofmonth, :yearmonth, :monthday, :yearmonthday, # base/dates/accessors.jl
:firstdayofweek, :lastdayofweek, :firstdayofmonth, :lastdayofmonth, :firstdayofyear, :lastdayofyear, :firstdayofquarter, :lastdayofquarter, # base/dates/adjusters.jl
:dayname, :dayabbr, :dayofweek, :dayofweekofmonth, :daysofweekinmonth, :monthname, :monthabbr, :daysinmonth, :isleapyear, :dayofyear, :daysinyear, :quarterofyear, :dayofquarter, # base/dates/query.jl
)
@eval @dep_vectorize_1arg Dates.TimeType $f
end
Expand Down

0 comments on commit 5e1feef

Please sign in to comment.