1.1.1 • Published 3 months ago

space-time v1.1.1

Weekly downloads
31
License
MIT
Repository
github
Last release
3 months ago

Human readable data size and time calculations.

import {bytes, ms} from 'space-time';

bytes('1mb');
bytes('12.5Mb');
bytes('1 gigabyte + 12MB');

ms('1h');
ms('1 hr and 30 mins');
ms('52w 5h 1d');
ms('52 weeks, 5 hours and 1 day to be precise');

Time functions support Date.now() relative calculations:

ms.now('+1 week'); // Date.now() + ms('1 week')
seconds.now('-7 days'); // seconds(Date.now() - ms('7 days'))

Other size/time conversion units available:

kilobytes('50 mb');
megabytes('100gb');
gigabytes('50 terabytes + 512mb');
terabytes('500mb');

seconds('1 year');
minutes('10 days');
hours('10000 seconds');
days('5.5 years');
weeks('49 days');
years('3 lunar months and 1024 days');
1.1.1

3 months ago

1.1.0

7 months ago

1.0.1

3 years ago

1.0.0

3 years ago

0.6.0

6 years ago

0.5.0

8 years ago