Skip to content

Commit 21f8841

Browse files
committed
removed one time error
1 parent da5d71e commit 21f8841

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

NEWS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
3939
1. `data.table(x=1, <expr>)`, where `<expr>` is an expression resulting in a 1-column matrix without column names, will eventually have names `x` and `V2`, not `x` and `V1`, consistent with `data.table(x=1, <expr>)` where `<expr>` results in an atomic vector, for example `data.table(x=1, cbind(1))` and `data.table(x=1, 1)` will both have columns named `x` and `V2`. In this release, the matrix case continues to be named `V1`, but the new behavior can be activated by setting `options(datatable.old.matrix.autoname)` to `FALSE`. See point 5 under Bug Fixes for more context; this change will provide more internal consistency as well as more consistency with `data.frame()`.
4040
41-
2. The behavior of `week()` will be changed in a future release to calculate weeks sequentially (days 1-7 as week 1), which is a potential breaking change. For now, the current "legacy" behavior remains the default, and a one-time deprecation warning will be issued. Users can control this behavior with the temporary option `options(datatable.week = "...")`:
41+
2. The behavior of `week()` will be changed in a future release to calculate weeks sequentially (days 1-7 as week 1), which is a potential breaking change. For now, the current "legacy" behavior remains the default, and a deprecation warning will be issued when the old and new behaviors differ. Users can control this behavior with the temporary option `options(datatable.week = "...")`:
4242
* `"sequential"`: Opt-in to the new, sequential behavior (no warning).
4343
* `"legacy"`: Continue using the legacy behavior but suppress the deprecation warning.
44-
See [#2611](https://github.com/Rdatatable/data.table/issues/2611) for details. Thanks @MichaelChirico for the report and @venom1204 for the PR.
45-
44+
See [#2611](https://github.com/Rdatatable/data.table/issues/2611) for details. Thanks @MichaelChirico for the report and @venom1204 for the PR.
45+
4646
### NEW FEATURES
4747
4848
1. New `sort_by()` method for data.tables, [#6662](https://github.com/Rdatatable/data.table/issues/6662). It uses `forder()` to improve upon the data.frame method and also matches `DT[order(...)]` behavior with respect to locale. Thanks @rikivillalba for the suggestion and PR.

src/idatetime.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "data.table.h"
22

3-
static int week_deprecation_warning_issued = 0;
4-
53
static const int YEARS400 = 146097;
64
static const int YEARS100 = 36524;
75
static const int YEARS4 = 1461;
@@ -152,7 +150,7 @@ SEXP convertDate(SEXP x, SEXP type)
152150

153151
bool use_sequential = !strcmp(mode, "sequential");
154152
bool use_legacy = !strcmp(mode, "legacy");
155-
bool can_warn = !use_sequential && !use_legacy && !week_deprecation_warning_issued;
153+
bool can_warn = !use_sequential && !use_legacy;
156154

157155
for (int i = 0; i < n; i++) {
158156
if (ix[i] == NA_INTEGER) {
@@ -170,9 +168,7 @@ SEXP convertDate(SEXP x, SEXP type)
170168
ansp[i] = old_week;
171169
if (can_warn && new_week != old_week) {
172170
warning(_("The default behavior of week() is changing. Previously ('legacy' mode), week numbers advanced every 7th day of the year. The new 'sequential' mode ensures the first week always has 7 days. For example, as.IDate('2023-01-07') returns week 2 in legacy mode but week 1 in sequential mode (week 2 starts on '2023-01-08'). To adopt the new behavior now, set options(datatable.week = 'sequential'). To keep the old results and silence this warning, set options(datatable.week = 'legacy'). See https://github.com/Rdatatable/data.table/issues/2611"));
173-
week_deprecation_warning_issued = 1;
174-
can_warn = false;
175-
171+
can_warn = false;
176172
}
177173
}
178174
}

0 commit comments

Comments
 (0)