Skip to content

Commit 46c839b

Browse files
authored
fix(date): persist all attributes passed by options (#735)
* fix(date): persist all attributes passed by options Store all attributes passed as option via Date:set, especially date_only. * chore: minimize adjustable attributes Minimize adjustable attributes to the smallest possible subset, that is actually needed. --------- Co-authored-by: Sebastian Flügge <[email protected]>
1 parent cb3c9bf commit 46c839b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lua/orgmode/objects/date.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,16 @@ end
9595
---@param time table
9696
---@return OrgDate
9797
function Date:from_time_table(time)
98-
local range_diff = self.timestamp_end and self.timestamp_end - self.timestamp or 0
99-
local timestamp = os.time(set_date_opts(time, {}, true))
98+
local timestamp_end = self.timestamp_end
99+
local timestamp = self.timestamp
100+
local range_diff = timestamp_end and timestamp_end - timestamp or 0
101+
timestamp = os.time(set_date_opts(time, {}, true))
100102
local opts = set_date_opts(os.date('*t', timestamp))
101-
opts.date_only = self.date_only
103+
if time.date_only ~= nil then
104+
opts.date_only = time.date_only
105+
else
106+
opts.date_only = self.date_only
107+
end
102108
opts.dayname = self.dayname
103109
opts.adjustments = self.adjustments
104110
opts.type = self.type

0 commit comments

Comments
 (0)