From 37ceda152f989657df54e4b09b6c43bd75267413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 13 Jun 2020 16:33:17 +0200 Subject: Change write-form of . --- module/datetime.scm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'module/datetime.scm') diff --git a/module/datetime.scm b/module/datetime.scm index 8591f6f9..14b6f53c 100644 --- a/module/datetime.scm +++ b/module/datetime.scm @@ -38,6 +38,10 @@ date? (year year) (month month) (day day)) +;;; NOTE all these printers would benefit from using datetime->string, +;;; that however is currently in the (datetime util) module, which leads +;;; to a dependency cycle. + (set-record-type-printer! (lambda (r p) @@ -85,11 +89,19 @@ (set-record-type-printer! (lambda (r p) - (write `(datetime date: ,(get-date r) - time: ,(get-time% r) - ,@(awhen (tz r) - `(tz: ,it))) - p))) + (if (tz r) + (write `(datetime date: ,(get-date r) + time: ,(get-time% r) + tz: ,(tz r)) + p) + (display + (string-append + (with-output-to-string (lambda () (write (get-date r)))) + "T" + (string-drop + (with-output-to-string (lambda () (write (get-time% r)))) + 1)) + p)))) (export get-date) (define-public (get-timezone datetime) -- cgit v1.2.3