Calendar

A calendar, allowing you to add notes to dates.

#!/usr/bin/pinafore
let

dateText : Date ~> Text;
dateText = property @Date @Text !"example.calendar:dateText";

ui : Ref Date -> UI;
ui r = uiVertical
    [
    (uiHorizontal
        [
        (uiButton {"<"} {do d <- get r; r := addDays (-1) d; end}, False),
        (uiLabel {unixFormatDate "%A, %B %e, %Y" %r}, True),
        (uiButton {">"} {do d <- get r; r := addDays 1 d; end}, False)
        ], False),
    (uiTextArea $ dateText !$ r, True)
    ];

in do
    r <- newMemRef;
    d <- getDate;
    r := d;
    openWindow {toText %r} {[]} $ ui r;
    end