{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14385","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14385/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14385/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14385/events","html_url":"https://github.com/JuliaLang/julia/pull/14385","id":121896497,"number":14385,"title":"BUG: Period Accessor should support Array","user":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/dates","name":"dates","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-13T03:47:13Z","updated_at":"2015-12-14T18:44:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/14385","html_url":"https://github.com/JuliaLang/julia/pull/14385","diff_url":"https://github.com/JuliaLang/julia/pull/14385.diff","patch_url":"https://github.com/JuliaLang/julia/pull/14385.patch"},"body":"This PR makes Period Accessors work for Arrays as Field Accessors do.\r\n\r\n#### Current master\r\n\r\n```\r\nDates.Year([DateTime(2013), DateTime(2014)])\r\n# ERROR: MethodError: Cannot `convert` an object of type Array{DateTime,1} to an object of type Base.Dates.Year\r\n# This may have arisen from a call to the constructor Base.Dates.Year(...),\r\n# since type constructors fall back to convert methods.\r\n# Closest candidates are:\r\n#   call{T}(::Type{T}, ::Any)\r\n#   convert{T<:Base.Dates.Period}(::Type{T<:Base.Dates.Period}, ::Real)\r\n#   convert(::Type{Base.Dates.Year}, ::Base.Dates.Month)\r\n#   ...\r\n#  in call at essentials.jl:58\r\n#  in eval at ./boot.jl:264\r\n```\r\n\r\n#### This PR\r\n\r\n```\r\nDates.Year([DateTime(2013), DateTime(2014)])\r\n# 2-element Array{Base.Dates.Year,1}:\r\n#  2013 years\r\n#  2014 years\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/164522303","html_url":"https://github.com/JuliaLang/julia/pull/14385#issuecomment-164522303","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14385","id":164522303,"user":{"login":"quinnj","id":2896623,"avatar_url":"https://avatars.githubusercontent.com/u/2896623?v=3","gravatar_id":"","url":"https://api.github.com/users/quinnj","html_url":"https://github.com/quinnj","followers_url":"https://api.github.com/users/quinnj/followers","following_url":"https://api.github.com/users/quinnj/following{/other_user}","gists_url":"https://api.github.com/users/quinnj/gists{/gist_id}","starred_url":"https://api.github.com/users/quinnj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quinnj/subscriptions","organizations_url":"https://api.github.com/users/quinnj/orgs","repos_url":"https://api.github.com/users/quinnj/repos","events_url":"https://api.github.com/users/quinnj/events{/privacy}","received_events_url":"https://api.github.com/users/quinnj/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T18:44:14Z","updated_at":"2015-12-14T18:44:14Z","body":"@sinhrks, thanks for the PR!\r\n\r\nThis is a bit tricky because we currently have:\r\n* `Year(x::TimeType) => Year`\r\n* `year(x::TimeType) => Int`\r\n\r\nSo there's an argument that both should allow vectorization if either does.\r\n\r\nCurrently, we do support auto-vectorization for most `Dates` operations, I'm inclined to allow both these definitions until something more consistent/firm is decided in #8450. @sinhrks, could you update the PR to vectorize both lowercase accessors as well as proper-case constructors?"}}