Open Presentation

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Date Variable

    A calendar date as an ISO YYYY-MM-DD string. No time zone and no clock are involved. '{{<id>}}' inserts it formatted with 'format'.

    Metadata

    Definition
    #/$defs/DateVariable
    Form
    object
    Source
    spec/schemas/opf.schema.json

    Field index

    FieldTypeReq.Description
    typeconstyesVariable kind. One of color, text, number, date, image, url or list.
    type · Allowed values
    "date"
    valuestring—ISO calendar date (YYYY-MM-DD) this variable resolves to.
    requiredboolean—Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted.
    labelstring—Optional short human label for forms and fill panels.
    descriptionstring—Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents.
    examplestring—Illustrative ISO date shown in fill forms and used when a template is previewed with examples. Never written to output.
    formatstring—Date display pattern, the same LDML-style tokens as header/footer dateFormat: yyyy, yy, MMMM, MMM, MM, M, dd, d, EEEE, EEE and quoted literals. The month and weekday names are those of the language where the date is drawn (the slide's declared language, else the deck's; English when none is declared or the table has no data for it); a month after a day token is in its form after a day, else its stand-alone form. Default: the language's long date pattern ('d. MMMM yyyy' in German), 'MMMM d, yyyy' for US English and a deck with no language.
    translationsobject—How the date is written in other languages, keyed by language tag, each entry a 'format': the date is the same in every language, its pattern is not. Where the variable is drawn, the slide's declared language (else the deck's) selects an entry: the exact tag, then the tag with its last subtag removed, and so on ('de-AT', then 'de'), compared without regard to case; no match uses the variable's own 'format'. A language read from the text does not select one. A fill that gives the variable a new value without translations removes them.

    type

    typeconstrequiredyesdefault—

    Variable kind. One of color, text, number, date, image, url or list.

    type · Allowed values
    "date"
    type.json
    {
      "type": "date"
    }

    value

    typestringrequirednodefault—pattern^\d{4}-\d{2}-\d{2}$

    ISO calendar date (YYYY-MM-DD) this variable resolves to.

    required

    typebooleanrequirednodefaulttrue

    Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted.

    label

    typestringrequirednodefault—

    Optional short human label for forms and fill panels.

    description

    typestringrequirednodefault—

    Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents.

    example

    typestringrequirednodefault—pattern^\d{4}-\d{2}-\d{2}$

    Illustrative ISO date shown in fill forms and used when a template is previewed with examples. Never written to output.

    format

    typestringrequirednodefault—

    Date display pattern, the same LDML-style tokens as header/footer dateFormat: yyyy, yy, MMMM, MMM, MM, M, dd, d, EEEE, EEE and quoted literals. The month and weekday names are those of the language where the date is drawn (the slide's declared language, else the deck's; English when none is declared or the table has no data for it); a month after a day token is in its form after a day, else its stand-alone form. Default: the language's long date pattern ('d. MMMM yyyy' in German), 'MMMM d, yyyy' for US English and a deck with no language.

    format.json
    {
      "format": "MMMM d, yyyy"
    }

    translations

    typeobjectrequirednodefault—

    How the date is written in other languages, keyed by language tag, each entry a 'format': the date is the same in every language, its pattern is not. Where the variable is drawn, the slide's declared language (else the deck's) selects an entry: the exact tag, then the tag with its last subtag removed, and so on ('de-AT', then 'de'), compared without regard to case; no match uses the variable's own 'format'. A language read from the text does not select one. A fill that gives the variable a new value without translations removes them.

    Complete definition constraints
    Schema constraints
    {
      "type": "object",
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "const": "date",
          "description": "Variable kind. One of color, text, number, date, image, url or list."
        },
        "value": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "ISO calendar date (YYYY-MM-DD) this variable resolves to."
        },
        "required": {
          "type": "boolean",
          "default": true,
          "description": "Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted."
        },
        "label": {
          "type": "string",
          "description": "Optional short human label for forms and fill panels."
        },
        "description": {
          "type": "string",
          "description": "Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents."
        },
        "example": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Illustrative ISO date shown in fill forms and used when a template is previewed with examples. Never written to output."
        },
        "format": {
          "type": "string",
          "description": "Date display pattern, the same LDML-style tokens as header/footer dateFormat: yyyy, yy, MMMM, MMM, MM, M, dd, d, EEEE, EEE and quoted literals. The month and weekday names are those of the language where the date is drawn (the slide's declared language, else the deck's; English when none is declared or the table has no data for it); a month after a day token is in its form after a day, else its stand-alone form. Default: the language's long date pattern ('d. MMMM yyyy' in German), 'MMMM d, yyyy' for US English and a deck with no language.",
          "examples": [
            "MMMM d, yyyy",
            "dd MMM yyyy",
            "M/d/yyyy",
            "EEEE, MMMM d"
          ]
        },
        "translations": {
          "type": "object",
          "propertyNames": {
            "$ref": "#/$defs/LanguageTag"
          },
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "format"
            ],
            "properties": {
              "format": {
                "type": "string",
                "description": "The date display pattern in this language, in the tokens of the variable's own 'format'."
              }
            }
          },
          "minProperties": 1,
          "description": "How the date is written in other languages, keyed by language tag, each entry a 'format': the date is the same in every language, its pattern is not. Where the variable is drawn, the slide's declared language (else the deck's) selects an entry: the exact tag, then the tag with its last subtag removed, and so on ('de-AT', then 'de'), compared without regard to case; no match uses the variable's own 'format'. A language read from the text does not select one. A fill that gives the variable a new value without translations removes them."
        }
      },
      "description": "A calendar date as an ISO YYYY-MM-DD string. No time zone and no clock are involved. '{{<id>}}' inserts it formatted with 'format'."
    }