forked from hustcc/timeago.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcs.ts
26 lines (24 loc) · 1.19 KB
/
cs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
export default function(number: number, index: number): [string, string] {
let inflectionIndex = 0;
const isInflectionNeeded =
index == 1 || index == 3 || index == 5 || index == 7 || index == 9 || index == 11 || index == 13;
if (isInflectionNeeded && number >= 5) {
inflectionIndex = 1;
}
return [
[['právě teď', 'právě teď']],
[['před %s vteřinami', 'za %s vteřiny'], ['před %s vteřinami', 'za %s vteřin']],
[['před minutou', 'za minutu']],
[['před %s minutami', 'za %s minuty'], ['před %s minutami', 'za %s minut']],
[['před hodinou', 'za hodinu']],
[['před %s hodinami', 'za %s hodiny'], ['před %s hodinami', 'za %s hodin']],
[['včera', 'zítra']],
[['před %s dny', 'za %s dny'], ['před %s dny', 'za %s dnů']],
[['minulý týden', 'příští týden']],
[['před %s týdny', 'za %s týdny'], ['před %s týdny', 'za %s týdnů']],
[['minulý měsíc', 'přístí měsíc']],
[['před %s měsíci', 'za %s měsíce'], ['před %s měsíci', 'za %s měsíců']],
[['před rokem', 'přístí rok']],
[['před %s lety', 'za %s roky'], ['před %s lety', 'za %s let']],
][index][inflectionIndex] as [string, string];
}