1.1.1 • Published 9 months ago

@jkob/format v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago
import f from "@jkob/format";

f.number('20'); // 20
f.number('20', 2); // 20.00
f.number('20', 1, 'km'); // 20.0 km

f.distance(2); // 2.00 km

f.elevation(1000); // 1000 m

f.time(80); // 1:20
f.time(3680); // 1:01:20
f.time(3610, true); // 1:00
f.time(3680, true); // 1:01

f.time(80); // 1 min
f.time(3680); // 1 h
f.time(3620, true); // 1 20 s
f.time(3680, true); // 1 h 1 min 20 s

f.date(new Date(), 'Y-m-d H:i:s'); // 2020-10-29 18:47:25
f.date(new Date(), 'x 2020'); // lipiec 2020
f.date(new Date(), 'w, D x'); // Czwartek, 29 październik 2020

Date formats

Y     full year // 2020
m     month with leading zero // 02
M     month without leading zero // 2
d     day with leading zeor // 02
D     day without leading zero // 2

h     hours with leading zero // 02
H     hours without leading zero // 2
i     minutes with leading zero // 02
I     minutes without leading zero // 2
s     seconds with leading zero // 02
S     seconds without leading zero // 2

w     day of week (long) // Wtorek
W     day of week (short) // Wt.

x     month (long) // listopad
X     month (short) // lis
1.1.1

9 months ago