Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-1524

Resolve relative dates in code and pass the current date and timezone with each tool-calling request

Evidence type
practitioner heuristic
Difficulty
easy
Roles
Applied AI, ML engineer
Industries
aviation

Summary: situation, action, reason, boundary

  1. Situation

    A customer writes move me to the first flight tomorrow morning, and the rebooking tool takes a departure date argument.

  2. Action

    Inject the current date, weekday and customer timezone into every request, have the model return both the original phrase and an ISO date, recompute the date in code from the phrase where possible, and reject dates in the past.

  3. Reason

    A model has no clock; unless the date is supplied in the prompt it can only guess today's date from its training data, and schema validation cannot tell a plausible wrong date from a right one.

  4. Boundary

    Agents and extractors that turn phrases such as tomorrow, next Friday or end of month into arguments.

Symptom or risk

The model fills in the date from a stale sense of today or ignores the airport's timezone, so a valid-looking call searches the wrong day.

Exceptions

Inputs that already carry absolute dates.

Trade-offs

A small date block in every prompt, which sits late in the prompt so it does not break a cached prefix.

Pitfalls

Using server time while the customer's timezone puts them on a different calendar day.

Lessons and concepts