Skip to content

Timestamp-like strings get reformatted in YAML #484

@davidselassie

Description

@davidselassie

Describe the bug
dasel seems to treat quoted timestamp-like strings as a timestamp type and will always reformat them.

To Reproduce

~> cat test.yaml 
timestampKey: "2025-09-30T23:19:51.974075Z"
otherKey: apple
~> dasel put -f test.yaml -v banana otherKey
~> cat test.yaml
timestampKey: 2025-09-30T23:19:51.974075Z
otherKey: banana
~> dasel put -f test.yaml -v pear otherKey
~> cat test.yaml
timestampKey: 2025-09-30 23:19:51.974075 +0000 UTC
otherKey: pear
~> dasel put -f test.yaml -v grape otherKey
~> cat test.yaml
timestampKey: 2025-09-30 23:19:51.974075 +0000 UTC
otherKey: grape

Expected behavior
I would have expected all quoted string values to remain the string type and remain quoted if their key is not being modified.

~> cat test.yaml 
timestampKey: "2025-09-30T23:19:51.974075Z"
otherKey: apple
~> dasel put -f test.yaml -v banana otherKey
~> cat test.yaml
timestampKey: "2025-09-30T23:19:51.974075Z"
otherKey: banana

Screenshots
N/A

Desktop (please complete the following information):

~> dasel --version
dasel version 2.8.1
~> uname -a
Darwin F74095J033 24.6.0 Darwin Kernel Version 24.6.0: Mon Aug 11 21:15:09 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6041 arm64 arm Darwin

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions