I am pleased to announced lubridate 1.6.0. Lubridate is designed to make working with dates and times as pleasant as possible, and is maintained by Vitalie Spinu . You can install the latest version with:
|
|
This release includes a range of bug fixes and minor improvements. Some highlights from this release include:
period()andduration()constructors now accept character strings and allow a very flexible specification of timespans:
|
|
Period and duration parsing allows for arbitrary abbreviations of time units as long as the specification is unambiguous. For single letter specs, strptime() rules are followed, so m stands for months and M for minutes.
These same rules allows you to compare strings and durations/periods:
|
|
- Date time rounding (with
round_date(),floor_date()andceiling_date()) now supports unit multipliers, like “3 days” or “2 months”:
|
|
-
The behavior of
ceiling_dateforDateobjects is now more intuitive. In short, dates are now interpreted as time intervals that are physically part of longer unit intervals:|day1| … |day31|day1| … |day28| … | January | February | …
That means that rounding up 2000-01-01 by a month is done to the boundary between January and February which, i.e. 2000-02-01:
|
|
This behavior is controlled by the change_on_boundary argument.
- It is now possible to compare
POSIXctandDateobjects:
|
|
-
C-level parsing now handles English months and AM/PM indicator regardless of your locale. This means that English date-times are now always handled by lubridate C-level parsing and you don’t need to explicitly switch the locale.
-
New parsing function
yq()allows you to parse a year + quarter:
|
|
The new q format is available in all lubridate parsing functions.
See the release notes for the full list of changes. A big thanks goes to everyone who contributed: @arneschillert , @cderv , @ijlyttle , @jasonelaw , @jonboiser , and @krlmlr .

