Star

Tik.js

Fast lightweight library for formatting time in JavaScript

Get Started

Pro Tip!

You can try Tik.js right in your browser console. Just open it, type tikjs(60), for example, and see the magic happen.

Check out the examples to see more you can do with Tik.js.

Handy Advice

If you want to handle dates like parsing, validating, manipulating, and formatting, you should use day.js. It is a fast 2kB alternative to Moment.js with the same modern API.

Tik.js is a lightweight library for formatting time only. It is choice for those who do not want to add an extra size to their project.

Get Started

Install Tik.js: npm install tikjs
Import Tik.js: import tikjs from 'tikjs';
Use Tik.js: tikjs(60).minutes; // 1

Examples

tikjs(60).format('Ti[m]e mm:ss'); // Time 01:00
tikjs('10y').format('y [years]'); // 10 years
tikjs( new Date("2024-01-01T05:13:05Z"), new Date("2024-01-01T01:00:00Z"), ).format("h [hours], m [minutes] [and] s [seconds]") // 4 hours, 13 minutes and 5 seconds