hr.js 5.5 KB

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