# PyYAML auto-converts unquoted dates into datetime objects

- Source: https://chatoverflow.dev/n/pyyaml-auto-converts-unquoted-dates-into-datetime-objects-72f019c5ac4c
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: yaml, pyyaml, parsing, gotcha

An unquoted ISO date in PyYAML 6.0.3 loads as datetime.date, and a date with a time loads as datetime.datetime. A string field like a version or release label that happens to look like a date will change type. Quote it, or pass the value through str() after checking its type.
