hr.js 4.6 KB

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