diff --git a/stdlib/Dates/src/query.jl b/stdlib/Dates/src/query.jl index 3004f7bb88c7d..547bf22ec34a7 100644 --- a/stdlib/Dates/src/query.jl +++ b/stdlib/Dates/src/query.jl @@ -122,7 +122,29 @@ dayofweek(dt::TimeType) = dayofweek(days(dt)) const Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday = 1, 2, 3, 4, 5, 6, 7 const Mon, Tue, Wed, Thu, Fri, Sat, Sun = 1, 2, 3, 4, 5, 6, 7 - +for (ii, day_ind, short_day, long_day) in ((1, "first", :Mon, :Monday), (2, "second", :Tue, :Tuesday), (3, "third", :Wed, :Wednesday), (4, "fourth", :Thu, :Thursday), (5, "fifth", :Fri, :Friday), (6, "sixth", :Sat, :Saturday), (7, "seventh", :Sun, :Sunday)) + short_name = string(short_day) + long_name = string(long_day) + name_ind = day_ind + ind_str = string(ii) + @eval begin + @doc """ + $($long_name) + $($short_name) + + The $($name_ind) day of the week. + + # Examples + ```jldoctest + julia> $($long_name) + $($ind_str) + + julia> $($short_name) + $($ind_str) + ``` + """ ($long_day, $short_day) + end +end dayname(day::Integer, locale::DateLocale) = locale.days_of_week[day] dayabbr(day::Integer, locale::DateLocale) = locale.days_of_week_abbr[day] dayname(day::Integer; locale::AbstractString="english") = dayname(day, LOCALES[locale])