From 7227b0cda7121db52aba3bc04bfeadbf678151c9 Mon Sep 17 00:00:00 2001 From: Sam Firke Date: Tue, 17 Jul 2018 14:17:56 -0400 Subject: [PATCH] Document excel_numeric_to_date changes for release --- NEWS.md | 6 ++++-- R/excel_dates.R | 3 ++- man/excel_numeric_to_date.Rd | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5b5f0a49..f3e9295e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# janitor 1.1 +# janitor 1.1 (2018-07-17) This release was requested by CRAN to address some minor package dependency issues. It also contains several updates and additions described below. @@ -12,7 +12,9 @@ The new function `row_to_names` handles the case where a dirty data file is read ## Breaking changes -As part of `excel_numeric_to_date()` now handling times, if a Date-only result is requested (the default) any fractional part of the date is now removed. The date itself is identical, but the underlying object now contains only the integer part of the date. For example, while under both the old and new versions of this function the call `excel_numeric_to_date_old(42001.1)` would return the Date object `"2014-12-28"`, calling `as.numeric` on this result would previously return `16432.1`, while now it returns `16432`. +As part of `excel_numeric_to_date()` now handling times, if a Date-only result is requested (the default behavior of `include_time = FALSE`), any fractional part of the date is now removed. The printed date itself is identical, but the internal representation of this object now contains only the integer part of the date. For example, while under both the old and new versions of this function the call `excel_numeric_to_date_old(42001.1)` would return the Date object `"2014-12-28"`, calling `as.numeric` on this Date result would previously return `16432.1`, while now it returns `16432`. + +This an improved behavior, as now `excel_numeric_to_date(42001.1, include_time = FALSE) == as.Date("2014-12-28")` returns TRUE, while previously it would appear to be equivalent from the printed value but this comparison would return FALSE. # janitor 1.0.0 (2018-03-17) diff --git a/R/excel_dates.R b/R/excel_dates.R index c7498fca..c7073182 100644 --- a/R/excel_dates.R +++ b/R/excel_dates.R @@ -24,7 +24,8 @@ #' excel_numeric_to_date(40000.5) # No time is included #' excel_numeric_to_date(40000.5, include_time = TRUE) # Time is included #' excel_numeric_to_date(40000.521, include_time = TRUE) # Time is included -#' excel_numeric_to_date(40000.521, include_time = TRUE, round_seconds = FALSE) # Time with fractional seconds is included +#' excel_numeric_to_date(40000.521, include_time = TRUE, +#' round_seconds = FALSE) # Time with fractional seconds is included # Converts a numeric value like 42414 into a date "2016-02-14" diff --git a/man/excel_numeric_to_date.Rd b/man/excel_numeric_to_date.Rd index 039986d7..317e7f3e 100644 --- a/man/excel_numeric_to_date.Rd +++ b/man/excel_numeric_to_date.Rd @@ -37,7 +37,8 @@ When using \code{include_time=TRUE} the returned object will not \examples{ excel_numeric_to_date(40000) excel_numeric_to_date(40000.5) # No time is included -excel_numeric_to_date(40000.5, include_time=TRUE) # Time is included -excel_numeric_to_date(40000.521, include_time=TRUE) # Time is included -excel_numeric_to_date(40000.521, include_time=TRUE, round_seconds=FALSE) # Time with fractional seconds is included +excel_numeric_to_date(40000.5, include_time = TRUE) # Time is included +excel_numeric_to_date(40000.521, include_time = TRUE) # Time is included +excel_numeric_to_date(40000.521, include_time = TRUE, + round_seconds = FALSE) # Time with fractional seconds is included }