mirror of
https://github.com/nushell/nushell.git
synced 2025-05-30 22:57:07 +02:00
No related issue. Decided in nushell's weekly meeting: see [meeting notes](https://hackmd.io/rA1YecqjRh6I5m8dTq7BHw) # Description Converting a date as a human readable string to a datetime: - currently: using the ``into datetime`` command - after this change: using ``date from-human`` command Also moved the ``--list-human`` flag to the new command. # User-Facing Changes - Users have to use a new command for parsing human readable datetimes. Result: ```nushell ~> date from-human --list ╭────┬───────────────────────────────────┬──────────────╮ │ # │ parseable human datetime examples │ result │ ├────┼───────────────────────────────────┼──────────────┤ │ 0 │ Today 18:30 │ in 6 hours │ │ 1 │ 2022-11-07 13:25:30 │ 2 years ago │ │ 2 │ 15:20 Friday │ in 6 days │ │ 3 │ This Friday 17:00 │ in 6 days │ │ 4 │ 13:25, Next Tuesday │ in 3 days │ │ 5 │ Last Friday at 19:45 │ 16 hours ago │ │ 6 │ In 3 days │ in 2 days │ │ 7 │ In 2 hours │ in 2 hours │ │ 8 │ 10 hours and 5 minutes ago │ 10 hours ago │ │ 9 │ 1 years ago │ a year ago │ │ 10 │ A year ago │ a year ago │ │ 11 │ A month ago │ a month ago │ │ 12 │ A week ago │ a week ago │ │ 13 │ A day ago │ a day ago │ │ 14 │ An hour ago │ an hour ago │ │ 15 │ A minute ago │ a minute ago │ │ 16 │ A second ago │ now │ │ 17 │ Now │ now │ ╰────┴───────────────────────────────────┴──────────────╯ ~> "2 days ago" | date from-human Thu, 3 Apr 2025 12:03:33 +0200 (2 days ago) ~> "2 days ago" | into datetime Error: nu:🐚:datetime_parse_error × Unable to parse datetime: [2 days ago]. ╭─[entry #5:1:1] 1 │ "2 days ago" | into datetime · ──────┬───── · ╰── datetime parsing failed ╰──── help: Examples of supported inputs: * "5 pm" * "2020/12/4" * "2020.12.04 22:10 +2" * "2020-04-12 22:10:57 +02:00" * "2020-04-12T22:10:57.213231+02:00" * "Tue, 1 Jul 2003 10:52:37 +0200" ``` # Tests + Formatting Fmt, clippy 🆗 Tests 🆗 > Note: I was able to reactivate one unit test in the ``into datetime`` command # After Submitting Here since the user facing changes are significant, I think we should communicate in the released notes. Otherwise the automatically generated documentation should be enough IMO.
This crate contains the majority of our commands
We allow ourselves to move some of the commands in nu-command
to nu-cmd-*
crates as needed.
Internal Nushell crate
This crate implements components of Nushell and is not designed to support plugin authors or other users directly.