aboutsummaryrefslogtreecommitdiff
path: root/utils/date.rkt
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-03-28 02:47:55 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-03-28 02:47:55 +0900
commitc114d5cedab38a2f6683eabb7c98e9943eecf8bf (patch)
tree28b8a5ad822a335e4e12f21cccaf603882006341 /utils/date.rkt
parent5556605d5c37ed902b075447723b71bed847c195 (diff)
Add utils/date module.
Diffstat (limited to 'utils/date.rkt')
-rw-r--r--utils/date.rkt22
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/date.rkt b/utils/date.rkt
new file mode 100644
index 0000000..7019832
--- /dev/null
+++ b/utils/date.rkt
@@ -0,0 +1,22 @@
+#lang typed/racket
+
+(provide current-date
+ string->date
+ date->string)
+
+(require (only-in typed/racket/date current-date))
+(require (rename-in (only-in typed/srfi/19
+ string->date
+ date->string
+ date?)
+ [string->date string->Date]
+ [date->string Date->string]
+ [date? Date?]))
+
+(: string->date (-> String String date))
+(define (string->date str fmt)
+ (assert (string->Date str fmt) date?))
+
+(: date->string (->* (date) (String) String))
+(define (date->string d [f "~c"])
+ (Date->string (assert d Date?) f))