Skip to content

str.to_datetime ignores '%z' #4220

@MarcoGorelli

Description

@MarcoGorelli

Describe the bug

The code below outputs

╭───────────────────────────────╮
│ a                             │
│ ---                           │
│ Timestamp(Microseconds, None) │
╞═══════════════════════════════╡
│ 2020-01-01 00:00:00           │
╰───────────────────────────────╯

thus ignoring the '%z'

To Reproduce

import daft
df = daft.from_pydict({'a': ['2020-01-01T00:00:00+01:00']})
df.select(daft.col('a').str.to_datetime('%Y-%m-%dT%H:%M:%S%z')).collect()

Expected behavior

probably

shape: (1, 1)
┌─────────────────────────┐
│ a                       │
│ ---                     │
│ datetime[μs, UTC]       │
╞═════════════════════════╡
│ 2019-12-31 23:00:00 UTC │
└─────────────────────────┘

Component(s)

Native Runner

Additional context

spotted in narwhals

Metadata

Metadata

Labels

bugSomething isn't workingnarwhalsFeatures/Bugs related to supporting narwhalsp1Important to tackle soon, but preemptable by p0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions