Wiki

trigger · date

Definition

  • Supported scope:any
  • Supported target:none

Description

checks for a specific date

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

date is commonly used to restrict the trigger window for certain decisions, events, or focuses—for example, allowing a technology to be unlocked or a war justification to be initiated only after a specific historical date. In alternate history mods, it is also frequently used to distinguish "historical periods" and ensure story events trigger at the correct point on the timeline.

# available block in a decision: only available after June 6, 1942
available = {
    date > 1942.6.6
    has_war = yes
}

Synergy

  • [has_start_date](/wiki/trigger/has_start_date): has_start_date checks the save game's start date. When paired with date, it helps distinguish between "initial game date" and "current game date," preventing logical confusion.
  • [or](/wiki/trigger/or) / [and](/wiki/trigger/and): Combining multiple date conditions constructs a "time window" (after date X and before date Y), which is the standard approach for restricting event trigger intervals.
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip): The UI tooltip for date conditions is sometimes not intuitive enough. Wrapping it with custom_trigger_tooltip allows you to display more user-friendly localized text to players.
  • [if](/wiki/effect/if) / [if](/wiki/trigger/if): Nesting date within the limit block of an if statement enables "execute different branches after reaching a certain date" dynamic logic.

Common Pitfalls

  1. Comparison direction reversed: date > 1939.9.1 means "current date is later than September 1, 1939." Beginners often mistakenly write date < 1939.9.1 intending to express "this date has been reached," resulting in completely inverted logic that causes conditions to never be satisfied or trigger prematurely.
  2. Incorrect date format: HOI4 scripts strictly require the date format YYYY.M.D (e.g., 1941.12.7). Writing it as 1941-12-07 or 1941/12/7 causes parsing to fail. The game typically provides no obvious error message and simply silently invalidates the condition.