OpenAI Incorrectly Handles Dates

OpenAI GPT models (GPT 4 at time of writing) do not accurately or consistently parse or manipulate dates.

For example:

  • Giving wrong year: when converting 2023-12-13 to a Unix timestamp and it returns the wrong year (2022 instead of 2023)
  • Wrong timezone: when converting an ISO date, it randomly adds on hours of time even if instructed to use UTC midnight
  • Giving current date: when asked to convert 2023-12-13 into a timestamp and it sometimes gives today’s date
  • Langchain Self Query With Dates

    Self querying by date using LangChain doesn’t work well. The default schema used for parsing natural language into the internal representation of langchain for querying a vector store does not work with dates because it uses the wrong type (it tries to use a dict but you can only filter using integers or strings).