twitter-time
v1.0.0
Published
Give ISO date, get twitter-like date format
Downloads
2
Readme
twitter-time
A straightforward npm package to convert ISO format dates to Twitter-like date representation.
The package exposes two functions:
- getTwitterTime:
- For getting twitter date formation: 1h, 1m, 1s, 1d.
- Requires providing valid ISO formatted date either with time ot not, e.g: "2023-07-15T08:45:30.123Z" or "2023-07-15".
- getTime:
- For getting only time: hh:mm.
- Requires providing time only, e.g: "08:45:30.123Z".
Installation
npm install twitter-time
Usage
getTwitterTime
const getTwitterTime = require("twitter-time").getTwitterTime;
const isoDate = "2023-07-15T08:45:30.123Z";
const twitterLikeDate = getTwitterTime(isoDate); // 15 Jul 2023
getTime
const getTime = require("twitter-time").getTime;
const isoDate = "08:45:30.123Z";
const twitterLikeDate = getTime(isoDate); // 08:45
License
This project is licensed under the MIT License.