Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kudrykv committed Nov 8, 2024
1 parent 0cb9f58 commit 2c9bfda
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/latex_yearly_planner/planners/mos/pages/weekly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@ def jotting_space
end

def format_day(day)
dayname = day.strftime('%A')
daynum = day.strftime('%-d')

first_day = params.months.first.first_day
last_day = params.months.last.last_day

if day < first_day || day > last_day
return "[#{i18n.t("calendar.weekdays.full.#{dayname.downcase}")}, #{daynum}]"
end
return day_label(day) if day < first_day || day > last_day

"link(<#{day.id}>, #{day_label(day)})"
end

def day_label(day)
dayname = day.strftime('%A')
daynum = day.strftime('%-d')

"link(<#{day.id}>, [#{i18n.t("calendar.weekdays.full.#{dayname.downcase}")}, #{daynum}])"
"[#{i18n.t("calendar.weekdays.full.#{dayname.downcase}")}, #{daynum}]"
end

def align_day(day)
Expand Down

0 comments on commit 2c9bfda

Please sign in to comment.