@@ -25,7 +25,28 @@ local time_format = '%H:%M'
25
25
--- @field related_date_range Date
26
26
--- @field dayname string
27
27
--- @field adjustments string[]
28
- local Date = {}
28
+ local Date = {
29
+ --- @type fun ( this : Date , other : Date ): boolean
30
+ __eq = function (this , other )
31
+ return this .timestamp == other .timestamp
32
+ end ,
33
+ --- @type fun ( this : Date , other : Date ): boolean
34
+ __lt = function (this , other )
35
+ return this .timestamp < other .timestamp
36
+ end ,
37
+ --- @type fun ( this : Date , other : Date ): boolean
38
+ __le = function (this , other )
39
+ return this .timestamp <= other .timestamp
40
+ end ,
41
+ --- @type fun ( this : Date , other : Date ): boolean
42
+ __gt = function (this , other )
43
+ return this .timestamp > other .timestamp
44
+ end ,
45
+ --- @type fun ( this : Date , other : Date ): boolean
46
+ __ge = function (this , other )
47
+ return this .timestamp >= other .timestamp
48
+ end ,
49
+ }
29
50
30
51
--- @param source table
31
52
--- @param target ? table
@@ -166,6 +187,12 @@ local function today(data)
166
187
return Date :new (opts )
167
188
end
168
189
190
+ --- @return Date
191
+ local function tomorrow ()
192
+ local today_date = today ()
193
+ return today_date :adjust (' +1d' )
194
+ end
195
+
169
196
--- @param data ? table
170
197
--- @return Date
171
198
local function now (data )
@@ -909,6 +936,7 @@ return {
909
936
from_string = from_string ,
910
937
now = now ,
911
938
today = today ,
939
+ tomorrow = tomorrow ,
912
940
parse_all_from_line = parse_all_from_line ,
913
941
is_valid_date = is_valid_date ,
914
942
is_date_instance = is_date_instance ,
0 commit comments