Skip to content

Commit 4c6cf0d

Browse files
fix(dates): Handle date as plain if added in plan line with different name
Fixes #708
1 parent a0f16dd commit 4c6cf0d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lua/orgmode/files/headline.lua

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -598,19 +598,21 @@ function Headline:get_plan_dates()
598598

599599
for _, node in ipairs(ts_utils.get_named_children(plan)) do
600600
local name_node = node:field('name')[1]
601-
local name = name_node and self.file:get_node_text(name_node) or 'NONE'
601+
local name = name_node and self.file:get_node_text(name_node)
602602
local timestamp = node:field('timestamp')[1]
603603

604-
if vim.tbl_contains(valid_plan_types, name:upper()) then
605-
if name_node then
606-
has_plan_dates = true
607-
end
608-
dates[name:upper()] = Date.from_org_date(self.file:get_node_text(timestamp), {
609-
range = Range.from_node(timestamp),
610-
type = name:upper(),
611-
})
612-
dates_nodes[name:upper()] = node
604+
if not name or not vim.tbl_contains(valid_plan_types, name:upper()) then
605+
name = 'NONE'
606+
end
607+
608+
if name ~= 'NONE' then
609+
has_plan_dates = true
613610
end
611+
dates[name:upper()] = Date.from_org_date(self.file:get_node_text(timestamp), {
612+
range = Range.from_node(timestamp),
613+
type = name:upper(),
614+
})
615+
dates_nodes[name:upper()] = node
614616
end
615617
return dates, dates_nodes, has_plan_dates
616618
end

0 commit comments

Comments
 (0)