diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor index a520eca53b..cb5ce20376 100644 --- a/basis/calendar/calendar-docs.factor +++ b/basis/calendar/calendar-docs.factor @@ -490,11 +490,15 @@ HELP: saturday HELP: midnight { $values { "timestamp" timestamp } { "new-timestamp" timestamp } } -{ $description "Returns a new timestamp that represents today at midnight, or the beginning of the day." } ; +{ $description "Returns a new timestamp that represents the day at midnight, or the beginning of the day." } ; HELP: noon { $values { "timestamp" timestamp } { "new-timestamp" timestamp } } -{ $description "Returns a new timestamp that represents today at noon, or the middle of the day." } ; +{ $description "Returns a new timestamp that represents the day at noon, or the middle of the day." } ; + +HELP: today +{ $values { "timestamp" timestamp } } +{ $description "Returns a timestamp that represents today at midnight." } ; HELP: beginning-of-month { $values { "timestamp" timestamp } { "new-timestamp" timestamp } } diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index b451cfcf05..2592e91322 100644 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -416,8 +416,11 @@ M: timestamp day-name day-of-week day-names nth ; : noon ( timestamp -- new-timestamp ) midnight 12 >>hour ; inline +: today ( -- timestamp ) + now midnight ; inline + : beginning-of-month ( timestamp -- new-timestamp ) - midnight 1 >>day ; + midnight 1 >>day ; inline : end-of-month ( timestamp -- new-timestamp ) [ midnight ] [ days-in-month ] bi >>day ;