hr.js 4.5 KB

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