
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Human readable time manipulation. Turn '2021-01-27T22:36:54.757Z' into '6 weeks ago' without going to time prison.
Simple human readable intervals for those that don't want to go to time prison.
Handy interval diff object for customisable, rounded, human readable phrases such as "in 3 days", "12 years ago", "a minute ago", "just now".
Inspiration take from Carbon
$ yarn add shleemy
Or
$ npm i shleemy
Get human readable values with tense information
Present
import { shleemy } from "shleemy";
const interval = shleemy(new Date());
console.log(interval.forHumans); // "just now"
console.log(interval.tense); // "present"
Past
import { shleemy } from "shleemy";
const date = new Date();
date.setMinutes(date.getMinutes() - 3);
console.log(shleemy(date).forHumans); // "3 minutes ago"
console.log(shleemy(date).tense); // "past"
Future
import { shleemy } from "shleemy";
const date = new Date();
date.setMinutes(date.getMinutes() + 70);
console.log(shleemy(date).forHumans); // "in an hour"
console.log(shleemy(date).tense); // "future"
import { shleemy } from "shleemy";
const date = new Date();
date.setHours(date.getHours() - 3);
console.log(shleemy(date).roundedHours); // 3
import { shleemy } from "shleemy";
const date = new Date();
date.setDays(date.getDays() - 12);
console.log(shleemy(date).roundedDays); // 12
console.log(shleemy(date).roundedWeeks); // 1
const date = new Date();
date.setDays(date.getDays() - 12);
const interval = shleemy(date);
console.log(interval.time); // 12:34
console.log(interval.date); // 12/03/2021
No locale as of now, so you backwards date people will have to do with day/month/year. Soz
The Shleemy object can be used as a string!
import { shleemy } from "shleemy";
const date = new Date();
date.setDays(date.getDays() - 12);
const interval = shleemy(date);
console.log(`added ${interval}`); // added 12 days ago;
console.log(`${interval.replace('days', 'yonders')}`); // 12 yonders ago;
Available properties
import { shleemy } from "shleemy";
const date = new Date();
date.setDays(date.getDays() - 12);
const interval = shleemy(date);
console.log('seconds', interval.seconds);
console.log('rounded seconds', interval.roundedSeconds);
console.log('minutes', interval.minutes);
console.log('rounded minutes', interval.roundedMinutes);
console.log('hours', interval.hours);
console.log('rounded hours', interval.roundedHours);
console.log('days', interval.days);
console.log('rounded days', interval.roundedDays);
console.log('weeks', interval.weeks);
console.log('rounded weeks', interval.roundedWeeks);
console.log('months', interval.months);
console.log('rounded months', interval.roundedMonths);
console.log('years', interval.years);
console.log('rounded years', interval.roundedYears);
console.log('tense', interval.tense);
All properties will be positive values. You cannot have -3 days in the 4th dimension. Use
tensefor past/present/future value
import { shleemy, ShleemyInterval } from "shleemy";
const date = new Date();
date.setDays(date.getDays() - 12);
const toDate = new Date();
toDate.setDays(toDate.getDays() - 20);
console.log(
shleemy(date, {
toDate: toDate, // default: new Date() (now)
rounding: 'ceil', // default: floor
humanReadable: {
past: (value, interval) => `${value} ${ShleemyInterval.pluralInterval(value, interval)} yonders ago`, // default: ShleemyInterval.toHumanReadablePast
future: (value, interval) => `in ${value} ${ShleemyInterval.pluralInterval(value, interval)} and you get the idea`, // default: ShleemyInterval.toHumanReadableFuture
present: () => `seconds ago!`, // default: "just now"
}
}).days
); // 8
FAQs
Human readable time manipulation. Turn '2021-01-27T22:36:54.757Z' into '6 weeks ago' without going to time prison.
We found that shleemy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.