Skip to content

Add list<datetime> support to date commands #18534

Closed

Description

@asevos

Basics

  • I have done a basic search through the issue tracker to find similar or related issues.
  • I have made myself familiar with the available features of Nushell for the particular area this enhancement request touches.

Related problem

When trying to use date to-timezone in pipeline with list type annotation you get an error:

 def 'date to-rfc-3339' [] : [datetime -> string, list<datetime> -> list<string>] {
    $in | date to-timezone UTC | format date $env.time_fmt_rfc_3339
}

Error: nu::parser::output_type_mismatch

  × Command output doesn't match list<string>.
   ╭─[repl_entry #1:1:83]
 1 │ ╭─▶  def 'date to-rfc-3339' [] : [datetime -> string, list<datetime> -> list<string>] {
 2 │ │       $in | date to-timezone UTC | format date $env.time_fmt_rfc_3339
 3 │ ├─▶ }
   · ╰──── expected list<string>, but command outputs string or table
   ╰────

This also gives an LSP error Command output doesn't match list<string>.

This error only surfaced after and update to v0.114.0. But I'm not sure I had a change to use this command on a list of datetimes before. It would be nice to have, since I handle JSONs with timestamps and expect to encounter a list of timestamps at some point

Describe the solution you'd like

Add input/output support for list<datetime> -> list<OUT_TYPE> to date commands. So they would work like into string or format date: both with lists and single values, returning value of the same type they got in

Describe alternatives you've considered

Right I am using each + helper that runs first on list if it only has one element. But it's 2 more commands that aren't really necessary

Additional context and details

No response

Activity

  1. added
    category:enhancement
    status:needs-triage
    on Jul 6, 2026
  2. cschanhniem commented on Jul 8, 2026

    @cschanhniem

    Adding list<datetime> support to date commands would be very useful for data pipeline use cases. Currently you have to either loop or use each { |d| | format date ... } which kills performance on large datasets.

    The implementation would likely follow the same pattern as how str commands handle lists — iterate over the input in the command's run method and apply the date operation to each element. The date commands already use the InputOutputType pattern for type checking, so adding Vec<DateTime> to the accepted input types should be straightforward.

    A good reference is how str trim or str replace handle list input — they use input.flat_map to process each element.

  3. added this to the v0.115.0 milestone on Jul 9, 2026
  4. modified the milestones: v0.115.0, v0.114.1 on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:enhancementstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions