scm: add utc-offset and date-object methods

Add methods for getting the utc-offset of message, and get the sent-date
as an SRFI-19 date object.
This commit is contained in:
Dirk-Jan C. Binnema
2026-07-27 23:55:25 +03:00
committed by Seth Ladygo
parent 0bea84adce
commit bb57f7a226
4 changed files with 57 additions and 8 deletions

View File

@ -613,6 +613,24 @@ For example:
=> 2025-06-16T09:00:31
@end lisp
@deffn {Scheme Procedure} date-object message
@end deffn
Get the message's @t{Date} field (the sent-date) in the form of an SRFI-19
date-object, or @t{#f} if there is none.
@deffn {Scheme Procedure} utc-offset message
@end deffn
Get the message's time-zone offset in seconds; negative for west of GMT,
positive for east of GMT, or @t{#f} if there is none.
For example:
@lisp
(date-object msg)
=> #<date nanosecond: 0 second: 25 minute: 57 hour: 14 day: 15 month: 5 year: 2016 zone-offset: -7200>
(utc-offset msg)
=> -7200
@end lisp
@deffn {Scheme Procedure} body message [#:html? #f]
@end deffn
Get the message body as a string, or return @code{#f} if not found.