8000 `into datetime -f` doesn't parse a valid format string · Issue #17432 · nushell/nushell · GitHub
[go: up one dir, main page]

Skip to content

into datetime -f doesn't parse a valid format string #17432

@asevos

Description

@asevos

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

When trying to convert unix epoch with milliseconds using into datetime -f "%s%3f" I get the following error: can't convert bad or unsupported format string to could not parse as datetime using format '%s%3f'. Worth mentioning, that format %s%.3f work fine.

It seems like a bug because using the same format string to format a date works as expected. Here is some output with unexpected behavior

> date now | format date "%s%3f"
1769503677954
> date now | format date "%s%3f" | into datetime -f "%s%3f" 
Error: nu::shell::cant_convert

  × Can't convert to could not parse as datetime using format '%s%3f'.
   ╭─[entry #42:1:34]
 1 │ date now | format date "%s%3f" | into datetime -f "%s%3f"
   ·                                  ──────┬──────
   ·                                        ╰── can't convert premature end of input to could not parse as datetime using format '%s%3f'
   ╰────
  help: you can use `into datetime` without a format string to enable flexible parsing

> '1769503677.954' | into datetime -f "%s%.3f"
27/01/26 08:47:57

How to reproduce

date now | format date "%s%3f" | into datetime -f "%s%3f"

Expected behavior

Get a datetime instead of an error

Configuration

key value
version 0.110.0
major 0
minor 110
patch 0
branch makepkg
commit_hash d40e191
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.92.0 (ded5c06cf 2025-12-08) (Arch Linux rust 1:1.92.0-1)
cargo_version cargo 1.92.0 (344c4567c 2025-10-21) (Arch Linux rust 1:1.92.0-1)
build_time 2026-01-18 07:22:50 +00:00
build_rust_channel release
allocator standard
features default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=true, pipefail=false, enforce-runtime-annotations=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:datetime-handlingSemantics and implementation of the datetime/duration types and commandscategory:upstreamproblem with upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0