date-strings: Add date->mbox-string
This commit is contained in:
parent
7810eba236
commit
bf84c6782a
|
@ -20,7 +20,7 @@
|
|||
;; Some of these formats have dedicated output codes in srfi-19 (~c, ~x, etc),
|
||||
;; but it looks like the chicken doesn't support them.
|
||||
(module date-strings
|
||||
(date->rfc339-string rfc339-string->date date->rfc228-string)
|
||||
(date->rfc339-string rfc339-string->date date->rfc228-string date->mbox-string)
|
||||
|
||||
(import scheme
|
||||
(chicken condition) (chicken format)
|
||||
|
@ -50,4 +50,11 @@
|
|||
[timezone (if (string=? timezone-raw "Z") "+0000" timezone-raw)])
|
||||
(format (date->string date "~~A, ~d ~~A ~Y ~T ~~A") weekday month timezone)))
|
||||
|
||||
|
||||
;; Converts a date into an mbox From-compatible string
|
||||
(define (date->mbox-string date)
|
||||
(let* ([month (string-titlecase (date->string date "~b"))]
|
||||
[weekday (string-titlecase (date->string date "~a"))])
|
||||
(format (date->string date "~~A ~~A ~d ~T ~Y") weekday month)))
|
||||
|
||||
) ;; date-strings module
|
||||
|
|
Ŝarĝante…
Reference in New Issue