Skip to content
Prev 62211 / 63421 Next

round.Date and trunc.Date not working / implemented

On 08/02/2024 7:58 p.m., Ji?? Moravec wrote:
If I were writing round.Date, I wouldn't offer the user an explicit 
option to round to seconds, minutes or hours.  So the header could be

     round.Date = function(x, units = c("days", "months", "years"))

Whether the function would complain if given other units like "secs" 
would need to be decided.

Like Henrik, I don't really like direct calls to methods such as your 
round.POSIXt call.  Those make assumptions that may not be true for 
weird corner cases where the class is not just "Date", but something 
more complicated that happens to have "Date" as one of the components of 
the class.  However, the related functions use that writing style, so I 
shouldn't complain too much.

Duncan Murdoch