Human-readable Date Format Web Component – slm-countdown

Category: Date & Time | February 25, 2022
Author:salemjs
Views Total:146 views
Official Page:Go to website
Last Update:February 25, 2022
License:MIT

Preview:

Human-readable Date Format Web Component – slm-countdown

Description:

slm-countdown is a tiny web component that converts the amount of time left or passed relative to a specific date into a human-readable format.

How to use it:

1. Import the slm-countdown.min.js into the document.

<script src="slm-countdown.min.js"></script>

2. Add the <slm-countdown ./> custom element to the page and specify the datetime in the datetime attribute.

<slm-countdown datetime='2022-01-01 01:00:00' />
=> 1 month ago
<slm-countdown datetime='2032-02-14 01:00:00' />
=> 10 years from now

You Might Be Interested In:


Leave a Reply