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) diff --git a/blog/2025-04-15-nushell_0_104_0.md b/blog/2025-04-15-nushell_0_104_0.md index 43561985d9d..5be7e3ba12d 100644 --- a/blog/2025-04-15-nushell_0_104_0.md +++ b/blog/2025-04-15-nushell_0_104_0.md @@ -42,6 +42,69 @@ 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 + +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) +~> "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 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) +~> {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) +``` + +The next ones are breaking changes. +```md +::: warning Breaking change +See a full overview of the [breaking changes](#breaking-changes) +::: +``` + +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 +``` + +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 ## Additions