1.2.1 • Published 10 months ago
@jkob/format v1.2.1
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.hm(80); // 1:20
f.time.hms(80); // 1:20
f.time.hm(3680); // 1:01
f.time.hms(3680); // 1:01:20
f.time.hm(3610); // 1:00
f.time.hms(3680); // 1:01:20
f.time.rel(80); // 1 min
f.time.rel(3680); // 1 h
f.time.rel(3620, true); // 1 20 s
f.time.rel(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 2020Date 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