hr.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split(
  72. '_'
  73. ),
  74. },
  75. monthsShort: 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split(
  76. '_'
  77. ),
  78. monthsParseExact: true,
  79. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  80. '_'
  81. ),
  82. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  83. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  84. weekdaysParseExact: true,
  85. longDateFormat: {
  86. LT: 'H:mm',
  87. LTS: 'H:mm:ss',
  88. L: 'DD.MM.YYYY',
  89. LL: 'Do MMMM YYYY',
  90. LLL: 'Do MMMM YYYY H:mm',
  91. LLLL: 'dddd, Do MMMM YYYY H:mm',
  92. },
  93. calendar: {
  94. sameDay: '[danas u] LT',
  95. nextDay: '[sutra u] LT',
  96. nextWeek: function () {
  97. switch (this.day()) {
  98. case 0:
  99. return '[u] [nedjelju] [u] LT';
  100. case 3:
  101. return '[u] [srijedu] [u] LT';
  102. case 6:
  103. return '[u] [subotu] [u] LT';
  104. case 1:
  105. case 2:
  106. case 4:
  107. case 5:
  108. return '[u] dddd [u] LT';
  109. }
  110. },
  111. lastDay: '[jučer u] LT',
  112. lastWeek: function () {
  113. switch (this.day()) {
  114. case 0:
  115. return '[prošlu] [nedjelju] [u] LT';
  116. case 3:
  117. return '[prošlu] [srijedu] [u] LT';
  118. case 6:
  119. return '[prošle] [subote] [u] LT';
  120. case 1:
  121. case 2:
  122. case 4:
  123. case 5:
  124. return '[prošli] dddd [u] LT';
  125. }
  126. },
  127. sameElse: 'L',
  128. },
  129. relativeTime: {
  130. future: 'za %s',
  131. past: 'prije %s',
  132. s: 'par sekundi',
  133. ss: translate,
  134. m: translate,
  135. mm: translate,
  136. h: translate,
  137. hh: translate,
  138. d: 'dan',
  139. dd: translate,
  140. M: 'mjesec',
  141. MM: translate,
  142. y: 'godinu',
  143. yy: translate,
  144. },
  145. dayOfMonthOrdinalParse: /\d{1,2}\./,
  146. ordinal: '%d.',
  147. week: {
  148. dow: 1, // Monday is the first day of the week.
  149. doy: 7, // The week that contains Jan 7th is the first week of the year.
  150. },
  151. });