UNPKG

3.81 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Hungarian [hu]
3//! author : Adam Brunner : https://github.com/adambrunner
4//! author : Peter Viszt : https://github.com/passatgt
5
6import moment from '../moment';
7
8var weekEndings =
9 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
10function translate(number, withoutSuffix, key, isFuture) {
11 var num = number;
12 switch (key) {
13 case 's':
14 return isFuture || withoutSuffix
15 ? 'néhány másodperc'
16 : 'néhány másodperce';
17 case 'ss':
18 return num + (isFuture || withoutSuffix)
19 ? ' másodperc'
20 : ' másodperce';
21 case 'm':
22 return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
23 case 'mm':
24 return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
25 case 'h':
26 return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
27 case 'hh':
28 return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
29 case 'd':
30 return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
31 case 'dd':
32 return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
33 case 'M':
34 return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
35 case 'MM':
36 return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
37 case 'y':
38 return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
39 case 'yy':
40 return num + (isFuture || withoutSuffix ? ' év' : ' éve');
41 }
42 return '';
43}
44function week(isFuture) {
45 return (
46 (isFuture ? '' : '[múlt] ') +
47 '[' +
48 weekEndings[this.day()] +
49 '] LT[-kor]'
50 );
51}
52
53export default moment.defineLocale('hu', {
54 months: 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split(
55 '_'
56 ),
57 monthsShort:
58 'jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.'.split(
59 '_'
60 ),
61 monthsParseExact: true,
62 weekdays: 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
63 weekdaysShort: 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
64 weekdaysMin: 'v_h_k_sze_cs_p_szo'.split('_'),
65 longDateFormat: {
66 LT: 'H:mm',
67 LTS: 'H:mm:ss',
68 L: 'YYYY.MM.DD.',
69 LL: 'YYYY. MMMM D.',
70 LLL: 'YYYY. MMMM D. H:mm',
71 LLLL: 'YYYY. MMMM D., dddd H:mm',
72 },
73 meridiemParse: /de|du/i,
74 isPM: function (input) {
75 return input.charAt(1).toLowerCase() === 'u';
76 },
77 meridiem: function (hours, minutes, isLower) {
78 if (hours < 12) {
79 return isLower === true ? 'de' : 'DE';
80 } else {
81 return isLower === true ? 'du' : 'DU';
82 }
83 },
84 calendar: {
85 sameDay: '[ma] LT[-kor]',
86 nextDay: '[holnap] LT[-kor]',
87 nextWeek: function () {
88 return week.call(this, true);
89 },
90 lastDay: '[tegnap] LT[-kor]',
91 lastWeek: function () {
92 return week.call(this, false);
93 },
94 sameElse: 'L',
95 },
96 relativeTime: {
97 future: '%s múlva',
98 past: '%s',
99 s: translate,
100 ss: translate,
101 m: translate,
102 mm: translate,
103 h: translate,
104 hh: translate,
105 d: translate,
106 dd: translate,
107 M: translate,
108 MM: translate,
109 y: translate,
110 yy: translate,
111 },
112 dayOfMonthOrdinalParse: /\d{1,2}\./,
113 ordinal: '%d.',
114 week: {
115 dow: 1, // Monday is the first day of the week.
116 doy: 4, // The week that contains Jan 4th is the first week of the year.
117 },
118});