Skip to content

Commit e950636

Browse files
fix: apply repeater for sorting only if it's the same day
1 parent bc1c96a commit e950636

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lua/orgmode/agenda/agenda_item.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,25 @@ local AgendaItem = {}
3030
function AgendaItem:new(headline_date, headline, date, index)
3131
local opts = {}
3232
opts.headline_date = headline_date
33-
opts.real_date = headline_date:apply_repeater_until(date)
33+
opts.real_date = headline_date
3434
opts.headline = headline
3535
opts.date = date
3636
opts.index = index or 1
3737
opts.is_valid = false
3838
opts.is_today = date:is_today()
39-
opts.is_same_day = headline_date:is_same(date, 'day') or headline_date:repeats_on(date)
39+
opts.repeats_on_date = false
40+
opts.is_same_day = headline_date:is_same(date, 'day')
41+
if not opts.is_same_day then
42+
opts.repeats_on_date = headline_date:repeats_on(date)
43+
opts.is_same_day = opts.repeats_on_date
44+
end
4045
opts.is_in_date_range = headline_date:is_none() and headline_date:is_in_date_range(date)
4146
opts.date_range_days = headline_date:get_date_range_days()
4247
opts.label = ''
4348
opts.highlights = {}
49+
if opts.repeats_on_date then
50+
opts.real_date = opts.headline_date:apply_repeater_until(opts.date)
51+
end
4452
setmetatable(opts, self)
4553
self.__index = self
4654
opts:_process()

lua/orgmode/objects/date.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ function Date:subtract(opts)
493493
end
494494

495495
---@param date Date
496-
---@param span string
496+
---@param span? string
497497
---@return boolean
498498
function Date:is_same(date, span)
499499
if not span then

0 commit comments

Comments
 (0)