Origami Frontend Components & Services

Readme: ft-date-format

ft-date-format provides javascript utilities for formatting and updating dates in FT style.

Usage

JavaScript

ft-date-format#format(date, tpl)

Returns a date formatted as a string

ft-date-format#timeAgo(date)

Returns the relative time since the given date, formatted as a human readable string e.g. 13 minutes ago.

ft-date-format#ftTime(date)

Returns relative time or timestamp for a given date, in accordance with FT date formatting conventions.

ft-date-format#asTodayOrYesterdayOrNothing(date)

Returns 'yesterday', 'today' or '' for a given date. You can request this formatting for ft-date-format components by adding data-ft-date-format-format="today-or-yesterday-or-nothing".


Contact

If you have any questions, comments, or need help using ft-date-format, please either raise an issue, visit #ft-origami or email Origami Support.


Licence

This software is published by the Financial Times under the MIT licence.

Status
maintained Origami v1 (Bower)
Switch component view

GitHub Repository