Skip to content

Commit 01c9f3f

Browse files
committed
NEWS bullet
1 parent 05e4666 commit 01c9f3f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

NEWS.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# clock (development version)
22

3+
* Parsing into a date-time type that is coarser than the original string is now
4+
considered ambiguous and undefined behavior. For example, parsing a string
5+
with fractional seconds using `date_time_parse(x)` or
6+
`naive_time_parse(x, precision = "second")` is no longer considered correct.
7+
Instead, if you only require second precision from such a string, parse the
8+
full string, with fractional seconds, into a clock type that can handle them,
9+
then round to seconds using whatever rounding convention is required for your
10+
use case, such as `time_point_floor()` (#230).
11+
12+
For example:
13+
14+
```
15+
x <- c("2019-01-01 00:00:59.123", "2019-01-01 00:00:59.556")
16+
17+
x <- naive_time_parse(x, precision = "millisecond")
18+
x
19+
#> <time_point<naive><millisecond>[2]>
20+
#> [1] "2019-01-01 00:00:59.123" "2019-01-01 00:00:59.556"
21+
22+
x <- time_point_round(x, "second")
23+
x
24+
#> <time_point<naive><second>[2]>
25+
#> [1] "2019-01-01 00:00:59" "2019-01-01 00:01:00"
26+
27+
as_date_time(x, "America/New_York")
28+
#> [1] "2019-01-01 00:00:59 EST" "2019-01-01 00:01:00 EST"
29+
```
30+
331
# clock 0.3.0
432

533
* New `date_seq()` for generating date and date-time sequences (#218).

0 commit comments

Comments
 (0)