hr.js (5658B)
1//! moment.js locale configuration 2//! locale : Croatian [hr] 3//! author : Bojan Marković : https://github.com/bmarkovic 4 5;(function (global, factory) { 6 typeof exports === 'object' && typeof module !== 'undefined' 7 && typeof require === 'function' ? factory(require('../moment')) : 8 typeof define === 'function' && define.amd ? define(['../moment'], factory) : 9 factory(global.moment) 10}(this, (function (moment) { 'use strict'; 11 12 //! moment.js locale configuration 13 14 function translate(number, withoutSuffix, key) { 15 var result = number + ' '; 16 switch (key) { 17 case 'ss': 18 if (number === 1) { 19 result += 'sekunda'; 20 } else if (number === 2 || number === 3 || number === 4) { 21 result += 'sekunde'; 22 } else { 23 result += 'sekundi'; 24 } 25 return result; 26 case 'm': 27 return withoutSuffix ? 'jedna minuta' : 'jedne minute'; 28 case 'mm': 29 if (number === 1) { 30 result += 'minuta'; 31 } else if (number === 2 || number === 3 || number === 4) { 32 result += 'minute'; 33 } else { 34 result += 'minuta'; 35 } 36 return result; 37 case 'h': 38 return withoutSuffix ? 'jedan sat' : 'jednog sata'; 39 case 'hh': 40 if (number === 1) { 41 result += 'sat'; 42 } else if (number === 2 || number === 3 || number === 4) { 43 result += 'sata'; 44 } else { 45 result += 'sati'; 46 } 47 return result; 48 case 'dd': 49 if (number === 1) { 50 result += 'dan'; 51 } else { 52 result += 'dana'; 53 } 54 return result; 55 case 'MM': 56 if (number === 1) { 57 result += 'mjesec'; 58 } else if (number === 2 || number === 3 || number === 4) { 59 result += 'mjeseca'; 60 } else { 61 result += 'mjeseci'; 62 } 63 return result; 64 case 'yy': 65 if (number === 1) { 66 result += 'godina'; 67 } else if (number === 2 || number === 3 || number === 4) { 68 result += 'godine'; 69 } else { 70 result += 'godina'; 71 } 72 return result; 73 } 74 } 75 76 var hr = moment.defineLocale('hr', { 77 months: { 78 format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split( 79 '_' 80 ), 81 standalone: 82 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split( 83 '_' 84 ), 85 }, 86 monthsShort: 87 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split( 88 '_' 89 ), 90 monthsParseExact: true, 91 weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( 92 '_' 93 ), 94 weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), 95 weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), 96 weekdaysParseExact: true, 97 longDateFormat: { 98 LT: 'H:mm', 99 LTS: 'H:mm:ss', 100 L: 'DD.MM.YYYY', 101 LL: 'Do MMMM YYYY', 102 LLL: 'Do MMMM YYYY H:mm', 103 LLLL: 'dddd, Do MMMM YYYY H:mm', 104 }, 105 calendar: { 106 sameDay: '[danas u] LT', 107 nextDay: '[sutra u] LT', 108 nextWeek: function () { 109 switch (this.day()) { 110 case 0: 111 return '[u] [nedjelju] [u] LT'; 112 case 3: 113 return '[u] [srijedu] [u] LT'; 114 case 6: 115 return '[u] [subotu] [u] LT'; 116 case 1: 117 case 2: 118 case 4: 119 case 5: 120 return '[u] dddd [u] LT'; 121 } 122 }, 123 lastDay: '[jučer u] LT', 124 lastWeek: function () { 125 switch (this.day()) { 126 case 0: 127 return '[prošlu] [nedjelju] [u] LT'; 128 case 3: 129 return '[prošlu] [srijedu] [u] LT'; 130 case 6: 131 return '[prošle] [subote] [u] LT'; 132 case 1: 133 case 2: 134 case 4: 135 case 5: 136 return '[prošli] dddd [u] LT'; 137 } 138 }, 139 sameElse: 'L', 140 }, 141 relativeTime: { 142 future: 'za %s', 143 past: 'prije %s', 144 s: 'par sekundi', 145 ss: translate, 146 m: translate, 147 mm: translate, 148 h: translate, 149 hh: translate, 150 d: 'dan', 151 dd: translate, 152 M: 'mjesec', 153 MM: translate, 154 y: 'godinu', 155 yy: translate, 156 }, 157 dayOfMonthOrdinalParse: /\d{1,2}\./, 158 ordinal: '%d.', 159 week: { 160 dow: 1, // Monday is the first day of the week. 161 doy: 7, // The week that contains Jan 7th is the first week of the year. 162 }, 163 }); 164 165 return hr; 166 167})));