Skip to content

Commit

Permalink
Simplify date calculations (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatanvasovic authored Aug 26, 2020
1 parent 31a4c0a commit 31d06cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ end
Plug in the list of blog posts contained in the `/blog/` folder.
"""
function hfun_blogposts()
curyear = Dates.Year(Dates.today()).value
curyear = year(Dates.today())
io = IOBuffer()
for year in curyear:-1:2012
ys = "$year"
year < curyear && write(io, "\n**$year**\n")
for month in 12:-1:1
ms = "0"^(1-div(month, 10)) * "$month"
ms = "0"^(month < 10) * "$month"
base = joinpath("blog", ys, ms)
isdir(base) || continue
posts = filter!(p -> endswith(p, ".md"), readdir(base))
Expand Down

0 comments on commit 31d06cd

Please sign in to comment.