aboutsummaryrefslogtreecommitdiff
path: root/utils/date.rkt
blob: 7019832e9c46de41149c4f4d17cca07a69781bd3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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))