Formats a timestamp as a localized string or as relative text that auto-updates in the user's browser. This allows the server to cache HTML fragments containing dates and lets the browser choose how to localize the displayed time according to the user's preferences. Every visitor is served the same markup from the server's cache. When it reaches the browser, the custom relative-time JavaScript localizes the element's text into the local timezone and formatting. Dates are displayed before months, and a 24-hour clock is used, according to the user's browser settings. If the browser's JavaScript is disabled, the default text served in the cached markup is still displayed.

Features

  • Web component extensions to the standard <time> element
  • Documentation available
  • Examples available
  • Browser Support
  • Browsers without native custom element support require a polyfill
  • Relative text that auto-updates in the user's browser

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Relative-Time Element

Relative-Time Element Web Site

You Might Also Like
Our Free Plans just got better! | Auth0 by Okta Icon
Our Free Plans just got better! | Auth0 by Okta

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your secuirty. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Relative-Time Element!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

JavaScript

Related Categories

JavaScript Localization (L10N) Software

Registered

2024-07-09