@@ -25,7 +25,28 @@ local time_format = '%H:%M'
2525--- @field related_date_range Date
2626--- @field dayname string
2727--- @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+ }
2950
3051--- @param source table
3152--- @param target ? table
@@ -166,6 +187,12 @@ local function today(data)
166187 return Date :new (opts )
167188end
168189
190+ --- @return Date
191+ local function tomorrow ()
192+ local today_date = today ()
193+ return today_date :adjust (' +1d' )
194+ end
195+
169196--- @param data ? table
170197--- @return Date
171198local function now (data )
@@ -909,6 +936,7 @@ return {
909936 from_string = from_string ,
910937 now = now ,
911938 today = today ,
939+ tomorrow = tomorrow ,
912940 parse_all_from_line = parse_all_from_line ,
913941 is_valid_date = is_valid_date ,
914942 is_date_instance = is_date_instance ,
0 commit comments