diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 23:46:57 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 23:46:57 +0200 |
commit | 9c94e6ec731ce433aadf12eae22d50e8fec7a91b (patch) | |
tree | dc3db263ba5c2afc725c5d163460597f233c1c8d /module/c | |
parent | Reformat test/datetime.scm (diff) | |
download | calp-9c94e6ec731ce433aadf12eae22d50e8fec7a91b.tar.gz calp-9c94e6ec731ce433aadf12eae22d50e8fec7a91b.tar.xz |
Remove (add|remove)-day, and month[+-].
Procedures where overly specific, and doing it manually was almost no
more work.
Diffstat (limited to '')
-rw-r--r-- | module/calp/entry-points/html.scm | 3 | ||||
-rw-r--r-- | module/calp/html/caltable.scm | 4 | ||||
-rw-r--r-- | module/calp/html/view/calendar/month.scm | 4 | ||||
-rw-r--r-- | module/calp/html/view/calendar/week.scm | 4 | ||||
-rw-r--r-- | module/calp/html/view/small-calendar.scm | 9 | ||||
-rw-r--r-- | module/calp/server/routes.scm | 6 | ||||
-rw-r--r-- | module/calp/terminal.scm | 4 |
7 files changed, 18 insertions, 16 deletions
diff --git a/module/calp/entry-points/html.scm b/module/calp/entry-points/html.scm index a324305b..2aa7e0e2 100644 --- a/module/calp/entry-points/html.scm +++ b/module/calp/entry-points/html.scm @@ -122,7 +122,8 @@ for embedding in a larger page. Currently only applies to the <i>small</i> style next-start: (lambda (d) (date+ d chunk-length)) prev-start: (lambda (d) (date- d chunk-length)) start-date: start-date - end-date: (remove-day (date+ start-date chunk-length)) + end-date: (date- (date+ start-date chunk-length) + (date day: 1)) render-calendar: render-calendar extra-args)))))) (stream-take count (date-stream chunk-length start-date)) diff --git a/module/calp/html/caltable.scm b/module/calp/html/caltable.scm index efaf8871..2c027c35 100644 --- a/module/calp/html/caltable.scm +++ b/module/calp/html/caltable.scm @@ -85,7 +85,7 @@ (lambda (d) (date<= d date (next-start d))) start-date)) "#" ,(date-link date))))) - (date-range pre-start (remove-day start-date))) + (date-range pre-start (date- start-date (date day: 1)))) ,@(map (td (lambda (date) `((href "#" ,(date-link date))))) @@ -101,4 +101,4 @@ (lambda (d) (and (date<= d date) (date< date (next-start d)))) start-date)) "#" ,(date-link date))))) - (date-range (add-day end-date) post-end)))) + (date-range (date+ end-date (date day: 1)) post-end)))) diff --git a/module/calp/html/view/calendar/month.scm b/module/calp/html/view/calendar/month.scm index d7cd24ae..1d151c77 100644 --- a/module/calp/html/view/calendar/month.scm +++ b/module/calp/html/view/calendar/month.scm @@ -59,7 +59,7 @@ (style "grid-area: long " ,i ";" "grid-column: 1 / span 7;") (data-start ,(date->string s)) - (data-end ,(date->string (add-day e)))) + (data-end ,(date->string (date+ e (date day: 1))))) ,@(lay-out-long-events s e events)))) long-event-groups @@ -76,7 +76,7 @@ `(div (@ (style "grid-area:short " ,i) (class "cal-cell cal-cell-short event-container") (data-start ,(date->string day-date)) - (data-end ,(date->string (add-day day-date)))) + (data-end ,(date->string (date+ day-date (date day: 1))))) (div (@ (style "overflow-y:auto;")) ,@(map make-small-block (stream->list events))))) short-event-groups diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index ef630c36..caad8912 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -43,7 +43,7 @@ ,@(time-marker-div) (div (@ (class "longevents event-container") (data-start ,(date->string start-date) ) - (data-end ,(date->string (add-day end-date)) ) + (data-end ,(date->string (date+ end-date (date day: 1))) ) (style "grid-column-end: span " ,(days-in-interval start-date end-date))) ,@(lay-out-long-events start-date end-date long-events)) ,@(map (lambda (day-date) @@ -139,7 +139,7 @@ `(div (@ (class "events event-container") (id ,(date-link day-date)) (data-start ,(date->string day-date)) - (data-end ,(date->string (add-day day-date)) )) + (data-end ,(date->string (date+ day-date (date day: 1))) )) ,@(map (lambda (time) `(div (@ (class "clock clock-" ,time)))) (iota 12 0 2)) diff --git a/module/calp/html/view/small-calendar.scm b/module/calp/html/view/small-calendar.scm index 4d40c57c..06a3342f 100644 --- a/module/calp/html/view/small-calendar.scm +++ b/module/calp/html/view/small-calendar.scm @@ -1,16 +1,17 @@ (define-module (calp html view small-calendar) :use-module ((calp html components) :select (xhtml-doc include-css)) :use-module ((calp html caltable) :select (cal-table)) - :use-module ((datetime) :select (month- month+ remove-day date->string)) + :use-module ((datetime) :select (date date+ date- date->string)) :export (render-small-calendar) ) (define (render-small-calendar month standalone) (define table (cal-table start-date: month - end-date: (remove-day (month+ month)) - next-start: month+ - prev-start: month- + end-date: (date- (date+ month (date month: 1)) + (date day: 1)) + next-start: (lambda (d) (date+ d (date day: 7))) + prev-start: (lambda (d) (date- d (date day: 7))) )) (if standalone (xhtml-doc diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm index 1fc31333..44fac7e8 100644 --- a/module/calp/server/routes.scm +++ b/module/calp/server/routes.scm @@ -175,10 +175,10 @@ (html-generate calendars: (get-calendars global-event-object) events: (get-event-set global-event-object) start-date: start-date - end-date: (date- (month+ start-date) + end-date: (date- (date+ start-date (date month: 1)) (date day: 1)) - next-start: month+ - prev-start: month- + next-start: (lambda (d) (date+ d (date month: 1))) + prev-start: (lambda (d) (date- d (date month: 1))) render-calendar: (@ (calp html view calendar month) render-calendar-table) pre-start: (start-of-week start-date) diff --git a/module/calp/terminal.scm b/module/calp/terminal.scm index 8f1b7fa9..ee3b7bc4 100644 --- a/module/calp/terminal.scm +++ b/module/calp/terminal.scm @@ -191,12 +191,12 @@ (case char ((#\L #\l right) - (set! (current-page this) = add-day + (set! (current-page this) = (date+ (date day: 1)) (cached-events this) #f (active-element this) 0)) ((#\h #\H left) - (set! (current-page this) = remove-day + (set! (current-page this) = (date- (date day: 1)) (cached-events this) #f (active-element this) 0)) |