From 3b3b7e014154039c6f3b4d271c89993d1dcac5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Riegel?= Date: Fri, 11 Apr 2025 23:54:42 +0200 Subject: [PATCH 1/3] release notes 0.104.0: datetime handling highlights --- blog/2025-04-15-nushell_0_104_0.md | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/blog/2025-04-15-nushell_0_104_0.md b/blog/2025-04-15-nushell_0_104_0.md index 43561985d9d..a7362ae9647 100644 --- a/blog/2025-04-15-nushell_0_104_0.md +++ b/blog/2025-04-15-nushell_0_104_0.md @@ -42,6 +42,39 @@ As part of this release, we also publish a set of optional [plugins](https://www for the list of available *containers* --> +## A lot of improvement and bug fixes regarding datetime handling + +Your local timezone is now accurately taken into account when parsing dates: +```nushell +~> "2025-01-01" | into datetime # standard time (winter) +Wed, 1 Jan 2025 00:00:00 +0100 (3 months ago) +~> "2025-06-01" | into datetime # daylight saving time (summer) +Sun, 1 Jun 2025 00:00:00 +0200 (in 2 months) +``` + +It is now possible to construct a datetime from a record input. If the timezone is not specified, the local is used. +```nushell +~> {year: 2025, month: 3, day: 30, hour: 12, minute: 15, second: 59, timezone: '+02:00'} | into datetime +Sun, 30 Mar 2025 12:15:59 +0200 (2 weeks ago) +``` + +Parsing a date as DMY is now possible using the `--format` option: +```nushell +~> "25/03/2024" | into datetime --format "%d/%m/%Y" +Mon, 25 Mar 2024 00:00:00 +0100 (a year ago) +``` + +```md +::: warning Breaking change +See a full overview of the [breaking changes](#breaking-changes) +::: +``` +Lastly, and this one is a breaking change, the human readable date parsing has been moved to a dedicated command. +```nushell +date from-human "next Friday at 6pm" +2025-04-18T18:00:00+02:00 +``` + # Changes ## Additions From cd25771997ba30645450551327f7936ff0c80d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Riegel?= Date: Sat, 12 Apr 2025 00:02:09 +0200 Subject: [PATCH 2/3] fix typos workflow --- blog/2024-01-09-nushell_0_89_0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/2024-01-09-nushell_0_89_0.md b/blog/2024-01-09-nushell_0_89_0.md index f827d63fd12..8873eb4c647 100644 --- a/blog/2024-01-09-nushell_0_89_0.md +++ b/blog/2024-01-09-nushell_0_89_0.md @@ -267,7 +267,7 @@ Setting the limits is done via flags available in `help ulimit`. - [Fix the test which fails on windows](https://github.com/nushell/nushell/pull/11478) - [Fix rm for symlinks pointing to directory on windows (issue #11461)](https://github.com/nushell/nushell/pull/11463) - [hustcer](https://github.com/hustcer) created - - [Try to fix riscv64 building by using unbuntu-latest](https://github.com/nushell/nushell/pull/11476) + - [Try to fix riscv64 building by using ubuntu-latest](https://github.com/nushell/nushell/pull/11476) - [Downgrade openssl-src to fix riscv64 build target, close #11345](https://github.com/nushell/nushell/pull/11353) - [rsteube](https://github.com/rsteube) created - [Revert "Return external file completions if not empty (#10898)"](https://github.com/nushell/nushell/pull/11446) From 123f54909a1beca54aac41fa05647222faf7e2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Riegel?= Date: Fri, 25 Apr 2025 13:44:33 +0200 Subject: [PATCH 3/3] update after further merges --- blog/2025-04-15-nushell_0_104_0.md | 44 +++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/blog/2025-04-15-nushell_0_104_0.md b/blog/2025-04-15-nushell_0_104_0.md index a7362ae9647..5be7e3ba12d 100644 --- a/blog/2025-04-15-nushell_0_104_0.md +++ b/blog/2025-04-15-nushell_0_104_0.md @@ -44,35 +44,65 @@ As part of this release, we also publish a set of optional [plugins](https://www ## A lot of improvement and bug fixes regarding datetime handling +Creating durations from non integer numbers used to result in a big loss of precision. This bug is now fixed. +```nushell +~> 1.5wk +# before => 1wk 3day +# now => 1wk 3day 12hr +``` + Your local timezone is now accurately taken into account when parsing dates: ```nushell ~> "2025-01-01" | into datetime # standard time (winter) -Wed, 1 Jan 2025 00:00:00 +0100 (3 months ago) +# => Wed, 1 Jan 2025 00:00:00 +0100 (3 months ago) ~> "2025-06-01" | into datetime # daylight saving time (summer) -Sun, 1 Jun 2025 00:00:00 +0200 (in 2 months) +# => Sun, 1 Jun 2025 00:00:00 +0200 (in 2 months) ``` -It is now possible to construct a datetime from a record input. If the timezone is not specified, the local is used. +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. ```nushell ~> {year: 2025, month: 3, day: 30, hour: 12, minute: 15, second: 59, timezone: '+02:00'} | into datetime -Sun, 30 Mar 2025 12:15:59 +0200 (2 weeks ago) +# => Sun, 30 Mar 2025 12:15:59 +0200 (2 weeks ago) +~> {week: 10, day: 1, hour: 2, minute: 3, second: 4, millisecond: 5, microsecond: 6, nanosecond: 7, sign: '-'} | into duration +# => ``` Parsing a date as DMY is now possible using the `--format` option: ```nushell ~> "25/03/2024" | into datetime --format "%d/%m/%Y" -Mon, 25 Mar 2024 00:00:00 +0100 (a year ago) +# => Mon, 25 Mar 2024 00:00:00 +0100 (a year ago) ``` +The next ones are breaking changes. ```md ::: warning Breaking change See a full overview of the [breaking changes](#breaking-changes) ::: ``` -Lastly, and this one is a breaking change, the human readable date parsing has been moved to a dedicated command. + +The human readable date parsing has been moved to a dedicated command. ```nushell date from-human "next Friday at 6pm" -2025-04-18T18:00:00+02:00 +# => 2025-04-18T18:00:00+02:00 +``` + +The ``str join`` command now outputs dates consistently: it is using RFC2822 by default, and RFC3339 for negative dates. +```nushell +~> [ 2024-01-01 ] | str join +# => Mon, 1 Jan 2024 00:00:00 +0000 +~> [ ('3000 years ago' | date from-human) ] | str join +# => -0975-04-23T20:57:56.221269600+00:00 +``` + +Now the ``start_timestamp`` column of the SQLite command history contains datetime instead of strings. +```nushell +~> history | last 2 +# => ╭───┬─────────────────┬─────────────────────┬─────┬─────╮ +# => │ # │ start_timestamp │ command │ cwd │ ... │ +# => ├───┼─────────────────┼─────────────────────┼─────┼─────┤ +# => │ 0 │ a minute ago │ history │ ... │ ... │ +# => │ 1 │ 40 seconds ago │ cd nushell │ ... │ ... │ +# => ╰───┴─────────────────┴─────────────────────┴─────┴─────╯ ``` # Changes