@@ -42,6 +42,69 @@ As part of this release, we also publish a set of optional [plugins](https://www
42
42
for the list of available *containers*
43
43
-->
44
44
45
+ ## A lot of improvement and bug fixes regarding datetime handling
46
+
47
+ Creating durations from non integer numbers used to result in a big loss of precision. This bug is now fixed.
48
+ ``` nushell
49
+ ~> 1.5wk
50
+ # before => 1wk 3day
51
+ # now => 1wk 3day 12hr
52
+ ```
53
+
54
+ Your local timezone is now accurately taken into account when parsing dates:
55
+ ``` nushell
56
+ ~> "2025-01-01" | into datetime # standard time (winter)
57
+ # => Wed, 1 Jan 2025 00:00:00 +0100 (3 months ago)
58
+ ~> "2025-06-01" | into datetime # daylight saving time (summer)
59
+ # => Sun, 1 Jun 2025 00:00:00 +0200 (in 2 months)
60
+ ```
61
+
62
+ It is now possible to construct a datetime and a duration from a record input. If the timezone is not specified, the local is used.
63
+ ``` nushell
64
+ ~> {year: 2025, month: 3, day: 30, hour: 12, minute: 15, second: 59, timezone: '+02:00'} | into datetime
65
+ # => Sun, 30 Mar 2025 12:15:59 +0200 (2 weeks ago)
66
+ ~> {week: 10, day: 1, hour: 2, minute: 3, second: 4, millisecond: 5, microsecond: 6, nanosecond: 7, sign: '-'} | into duration
67
+ # =>
68
+ ```
69
+
70
+ Parsing a date as DMY is now possible using the ` --format ` option:
71
+ ``` nushell
72
+ ~> "25/03/2024" | into datetime --format "%d/%m/%Y"
73
+ # => Mon, 25 Mar 2024 00:00:00 +0100 (a year ago)
74
+ ```
75
+
76
+ The next ones are breaking changes.
77
+ ``` md
78
+ ::: warning Breaking change
79
+ See a full overview of the [breaking changes](#breaking-changes)
80
+ :::
81
+ ```
82
+
83
+ The human readable date parsing has been moved to a dedicated command.
84
+ ``` nushell
85
+ date from-human "next Friday at 6pm"
86
+ # => 2025-04-18T18:00:00+02:00
87
+ ```
88
+
89
+ The `` str join `` command now outputs dates consistently: it is using RFC2822 by default, and RFC3339 for negative dates.
90
+ ``` nushell
91
+ ~> [ 2024-01-01 ] | str join
92
+ # => Mon, 1 Jan 2024 00:00:00 +0000
93
+ ~> [ ('3000 years ago' | date from-human) ] | str join
94
+ # => -0975-04-23T20:57:56.221269600+00:00
95
+ ```
96
+
97
+ Now the `` start_timestamp `` column of the SQLite command history contains datetime instead of strings.
98
+ ``` nushell
99
+ ~> history | last 2
100
+ # => ╭───┬─────────────────┬─────────────────────┬─────┬─────╮
101
+ # => │ # │ start_timestamp │ command │ cwd │ ... │
102
+ # => ├───┼─────────────────┼─────────────────────┼─────┼─────┤
103
+ # => │ 0 │ a minute ago │ history │ ... │ ... │
104
+ # => │ 1 │ 40 seconds ago │ cd nushell │ ... │ ... │
105
+ # => ╰───┴─────────────────┴─────────────────────┴─────┴─────╯
106
+ ```
107
+
45
108
# Changes
46
109
47
110
## Additions
0 commit comments