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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var formatDistanceLocale = {
lessThanXSeconds: {
one: {
regular: 'mniej niż sekunda',
past: 'mniej niż sekundę',
future: 'mniej niż sekundę'
},
twoFour: 'mniej niż {{count}} sekundy',
other: 'mniej niż {{count}} sekund'
},
xSeconds: {
one: {
regular: 'sekunda',
past: 'sekundę',
future: 'sekundę'
},
twoFour: '{{count}} sekundy',
other: '{{count}} sekund'
},
halfAMinute: {
one: 'pół minuty',
twoFour: 'pół minuty',
other: 'pół minuty'
},
lessThanXMinutes: {
one: {
regular: 'mniej niż minuta',
past: 'mniej niż minutę',
future: 'mniej niż minutę'
},
twoFour: 'mniej niż {{count}} minuty',
other: 'mniej niż {{count}} minut'
},
xMinutes: {
one: {
regular: 'minuta',
past: 'minutę',
future: 'minutę'
},
twoFour: '{{count}} minuty',
other: '{{count}} minut'
},
aboutXHours: {
one: {
regular: 'około godziny',
past: 'około godziny',
future: 'około godzinę'
},
twoFour: 'około {{count}} godziny',
other: 'około {{count}} godzin'
},
xHours: {
one: {
regular: 'godzina',
past: 'godzinę',
future: 'godzinę'
},
twoFour: '{{count}} godziny',
other: '{{count}} godzin'
},
xDays: {
one: {
regular: 'dzień',
past: 'dzień',
future: '1 dzień'
},
twoFour: '{{count}} dni',
other: '{{count}} dni'
},
aboutXWeeks: {
one: 'około tygodnia',
twoFour: 'około {{count}} tygodni',
other: 'około {{count}} tygodni'
},
xWeeks: {
one: 'tydzień',
twoFour: '{{count}} tygodnie',
other: '{{count}} tygodni'
},
aboutXMonths: {
one: 'około miesiąc',
twoFour: 'około {{count}} miesiące',
other: 'około {{count}} miesięcy'
},
xMonths: {
one: 'miesiąc',
twoFour: '{{count}} miesiące',
other: '{{count}} miesięcy'
},
aboutXYears: {
one: 'około rok',
twoFour: 'około {{count}} lata',
other: 'około {{count}} lat'
},
xYears: {
one: 'rok',
twoFour: '{{count}} lata',
other: '{{count}} lat'
},
overXYears: {
one: 'ponad rok',
twoFour: 'ponad {{count}} lata',
other: 'ponad {{count}} lat'
},
almostXYears: {
one: 'prawie rok',
twoFour: 'prawie {{count}} lata',
other: 'prawie {{count}} lat'
}
};
function declensionGroup(scheme, count) {
if (count === 1) {
return scheme.one;
}
var rem100 = count % 100;
// ends with 11-20
if (rem100 <= 20 && rem100 > 10) {
return scheme.other;
}
var rem10 = rem100 % 10;
// ends with 2, 3, 4
if (rem10 >= 2 && rem10 <= 4) {
return scheme.twoFour;
}
return scheme.other;
}
function declension(scheme, count, time) {
var group = declensionGroup(scheme, count);
var finalText = typeof group === 'string' ? group : group[time];
return finalText.replace('{{count}}', String(count));
}
var formatDistance = function formatDistance(token, count, options) {
var scheme = formatDistanceLocale[token];
if (!(options !== null && options !== void 0 && options.addSuffix)) {
return declension(scheme, count, 'regular');
}
if (options.comparison && options.comparison > 0) {
return 'za ' + declension(scheme, count, 'future');
} else {
return declension(scheme, count, 'past') + ' temu';
}
};
var _default = formatDistance;
exports.default = _default;
module.exports = exports.default;
|