Airframe GitHub Storybook
Component

ba-date

Renders the inputted date in the correct format for the current locale

Airframe

Active
Figma

Web Components

Active
Storybook GitHub

React

Active
Storybook GitHub

React Native

Beta
GitHub
Design Code Accessibility QA
A

Date text

The formatted date value rendered in the correct locale-aware format, displayed inline within the surrounding text content

ba-date is designed to be used within a text tag such as a h1, h2, h3, h4, h5, h6 or p that is nested within ba-content. This allows ba-date to use the correct styling and fonts.


<ba-date date="2020-01-01"></ba-date>
Property Attribute Description Type Default
date(required) date An ISO date string string undefined
locale locale The locale to use for formatting the date string | undefined undefined
  • None

No slotted content available for this component.

ba-date can be slotted into:

  • <h1>
  • <h2>
  • <h3>
  • <h4>
  • <h5>
  • <h6>
  • <p>

Rendering a date

A simple example that renders the date
<ba-content>
  <p>
    <ba-date date="2024-11-12"></ba-date>
  </p>
</ba-content>

The component picks up on the set locale of the page, or the closest lang attribute. If the locale is set to en it defaults to en-gb.

An example showing setting a different locale
<html lang="en">
  <ba-page-segment>
    <ba-content>
      <p>
        <ba-date lang="fr" date="2024-11-12"></ba-date> <!-- Will render in french from lang tag on component -->
      </p>
    </ba-content>
  </ba-page-segment>

  <ba-page-segment lang="es">
    <ba-content>
      <p>
        <ba-date date="2024-11-12"></ba-date> <!-- Will render in spanish from lang tag on page-segment -->
      </p>
    </ba-content>
  </ba-page-segment>

  <ba-page-segment>
    <ba-content>
      <p>
        <ba-date date="2024-11-12"></ba-date> <!-- Will render in english from lang tag on html tag -->
      </p>
    </ba-content>
  </ba-page-segment>
</html>
Prop Description Type Default
date (required) An ISO date string string undefined
locale The locale to use for formatting the date string | undefined undefined

None

BaDate can be slotted into:

  • <h1>
  • <h2>
  • <h3>
  • <h4>
  • <h5>
  • <h6>
  • <p>

Rendering a date

A simple example that renders the date
<BaContent>
  <p>
    <BaDate date="2024-11-12" />
  </p>
</BaContent>

The component picks up on the set locale of the page, or the closest lang attribute. If the locale is set to en it defaults to en-gb.

An example showing setting a different locale
<html lang="en">
  <BaPageSegment>
    <BaContent>
      <p>
        <BaDate lang="fr" date="2024-11-12" /> <!-- Will render in french from lang tag on component -->
      </p>
    </BaContent>
  </BaPageSegment>

  <BaPageSegment lang="es">
    <BaContent>
      <p>
        <BaDate date="2024-11-12" /> <!-- Will render in spanish from lang tag on page-segment -->
      </p>
    </BaContent>
  </BaPageSegment>

  <BaPageSegment>
    <BaContent>
      <p>
        <BaDate date="2024-11-12" /> <!-- Will render in english from lang tag on html tag -->
      </p>
    </BaContent>
  </BaPageSegment>
</html>
Prop Description Type Default
date (required) ISO date string (date part used; time ignored). string
locale Locale for formatting. When set, used as given (en stays UK English).
When omitted, the device language tag is mapped onto the formatter codes.
iOS uses the first AppleLanguages entry. Android uses I18nManager's localeIdentifier.
string
testID Used to locate this view in end-to-end tests. string
accessibilityLabel Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
string
accessibilityHint An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label. string
accessibilityState Accessibility State tells a person using either VoiceOver on iOS or TalkBack on Android the state of the element currently focused on. AccessibilityState
numberOfLines Used to truncate the text with an ellipsis after computing the text
layout, including line wrapping, such that the total number of lines
does not exceed this number.

This prop is commonly used with ellipsizeMode.
number
ellipsizeMode This can be one of the following values:

- head - The line is displayed so that the end fits in the container and the missing text
at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
- middle - The line is displayed so that the beginning and end fit in the container and the
missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
- tail - The line is displayed so that the beginning fits in the container and the
missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
- clip - Lines are not drawn past the edge of the text container.

The default is tail.

numberOfLines must be set in conjunction with this prop.

> clip is working only for iOS
"head" | "middle" | "tail" | "clip"

Put BaDate in <BaText>. BaText sets the type size and the text colour.

Put that BaText in <BaContent>. BaContent sets the gap.

Pass an ISO date. Any time portion is ignored.

Omit locale to follow the device. iOS uses the first entry in AppleLanguages. Android uses the locale from I18nManager. UK English looks like Thursday 6 August 2026. A US device looks like Thursday, August 6, 2026. A language change restarts the app, so an open screen keeps the language it started with.

A date that follows the device language
<BaContent>
  <BaText>
    <BaDate date="2026-08-06" />
  </BaText>
</BaContent>

Set variant on BaText. The date uses that size.

A date in a header28 BaText
<BaContent>
  <BaText variant="header28">
    <BaDate date="2026-08-06" />
  </BaText>
</BaContent>

Supported locale values are en, en-us, fr, es, it, pt, de, pl, ja, and zh. en is UK English. A value outside that list is shown in UK English.

When locale is omitted, the device language is mapped onto that list. US English uses en-us. Other English regions use en. A device language outside the list is shown in UK English.

The component sets accessibilityLanguage from the resolved locale, so VoiceOver speaks the date in that language. en is en-GB. en-us is en-US. zh stays zh.

The same date formatted for the United States and for France
<BaContent>
  <BaText>
    <BaDate date="2026-08-06" locale="en-us" />
  </BaText>
  <BaText>
    <BaDate date="2026-08-06" locale="fr" />
  </BaText>
</BaContent>

ba-date formats the date based on the locale determined by the nearest lang attribute in the DOM. When the locale is set to en it defaults to en-gb.

Screen readers announce dates according to the locale, so setting the correct lang attribute on the page, a wrapping element, or the component itself ensures the date is read in the intended language.

Further reading:

State: ba-date is a display-only component

⇥ Tab

Focus passes through ba-date to the next tabbable element; ba-date itself is not focusable

Use this checklist to confirm the component has been configured and used correctly.

  • ba-date is nested within a text tag (h1–h6 or p) inside ba-content so that it inherits the correct styling and fonts
  • The date attribute is a valid ISO 8601 date string (e.g. 2024-11-12)
  • The rendered date is meaningful in context and does not rely on visual formatting alone to convey information
  • The correct lang attribute is set on the page or nearest ancestor so the date is read aloud in the intended language by screen readers

These checks are handled by the component and do not need to be repeated each time it is used.

  • Date is formatted correctly for the active locale
  • Falls back to en-gb when the lang attribute is set to en
  • Picks up the lang attribute from the nearest ancestor when no lang is set directly on the component
  • Colour contrast meets requirements in all BAgel themes
  • High contrast mode adjustments
Designing Developing Components BAgel helper Web QA React Native QA britishairways.com Careers Cookie policy