me.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //! moment.js locale configuration
  2. ;(function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined'
  4. && typeof require === 'function' ? factory(require('../moment')) :
  5. typeof define === 'function' && define.amd ? define(['../moment'], factory) :
  6. factory(global.moment)
  7. }(this, (function (moment) { 'use strict';
  8. var translator = {
  9. words: { //Different grammatical cases
  10. ss: ['sekund', 'sekunda', 'sekundi'],
  11. m: ['jedan minut', 'jednog minuta'],
  12. mm: ['minut', 'minuta', 'minuta'],
  13. h: ['jedan sat', 'jednog sata'],
  14. hh: ['sat', 'sata', 'sati'],
  15. dd: ['dan', 'dana', 'dana'],
  16. MM: ['mjesec', 'mjeseca', 'mjeseci'],
  17. yy: ['godina', 'godine', 'godina']
  18. },
  19. correctGrammaticalCase: function (number, wordKey) {
  20. return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
  21. },
  22. translate: function (number, withoutSuffix, key) {
  23. var wordKey = translator.words[key];
  24. if (key.length === 1) {
  25. return withoutSuffix ? wordKey[0] : wordKey[1];
  26. } else {
  27. return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
  28. }
  29. }
  30. };
  31. var me = moment.defineLocale('me', {
  32. months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'),
  33. monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
  34. monthsParseExact : true,
  35. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
  36. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  37. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  38. weekdaysParseExact : true,
  39. longDateFormat: {
  40. LT: 'H:mm',
  41. LTS : 'H:mm:ss',
  42. L: 'DD.MM.YYYY',
  43. LL: 'D. MMMM YYYY',
  44. LLL: 'D. MMMM YYYY H:mm',
  45. LLLL: 'dddd, D. MMMM YYYY H:mm'
  46. },
  47. calendar: {
  48. sameDay: '[danas u] LT',
  49. nextDay: '[sjutra u] LT',
  50. nextWeek: function () {
  51. switch (this.day()) {
  52. case 0:
  53. return '[u] [nedjelju] [u] LT';
  54. case 3:
  55. return '[u] [srijedu] [u] LT';
  56. case 6:
  57. return '[u] [subotu] [u] LT';
  58. case 1:
  59. case 2:
  60. case 4:
  61. case 5:
  62. return '[u] dddd [u] LT';
  63. }
  64. },
  65. lastDay : '[juče u] LT',
  66. lastWeek : function () {
  67. var lastWeekDays = [
  68. '[prošle] [nedjelje] [u] LT',
  69. '[prošlog] [ponedjeljka] [u] LT',
  70. '[prošlog] [utorka] [u] LT',
  71. '[prošle] [srijede] [u] LT',
  72. '[prošlog] [četvrtka] [u] LT',
  73. '[prošlog] [petka] [u] LT',
  74. '[prošle] [subote] [u] LT'
  75. ];
  76. return lastWeekDays[this.day()];
  77. },
  78. sameElse : 'L'
  79. },
  80. relativeTime : {
  81. future : 'za %s',
  82. past : 'prije %s',
  83. s : 'nekoliko sekundi',
  84. ss : translator.translate,
  85. m : translator.translate,
  86. mm : translator.translate,
  87. h : translator.translate,
  88. hh : translator.translate,
  89. d : 'dan',
  90. dd : translator.translate,
  91. M : 'mjesec',
  92. MM : translator.translate,
  93. y : 'godinu',
  94. yy : translator.translate
  95. },
  96. dayOfMonthOrdinalParse: /\d{1,2}\./,
  97. ordinal : '%d.',
  98. week : {
  99. dow : 1, // Monday is the first day of the week.
  100. doy : 7 // The week that contains Jan 7th is the first week of the year.
  101. }
  102. });
  103. return me;
  104. })));