index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _index = _interopRequireDefault(require("../../../../_lib/isSameUTCWeek/index.js"));
  8. var weekdays = ['недела', 'понеделник', 'вторник', 'среда', 'четврток', 'петок', 'сабота'];
  9. function _lastWeek(day) {
  10. var weekday = weekdays[day];
  11. switch (day) {
  12. case 0:
  13. case 3:
  14. case 6:
  15. return "'минатата " + weekday + " во' p";
  16. case 1:
  17. case 2:
  18. case 4:
  19. case 5:
  20. return "'минатиот " + weekday + " во' p";
  21. }
  22. }
  23. function thisWeek(day) {
  24. var weekday = weekdays[day];
  25. switch (day) {
  26. case 0:
  27. case 3:
  28. case 6:
  29. return "'ова " + weekday + " вo' p";
  30. case 1:
  31. case 2:
  32. case 4:
  33. case 5:
  34. return "'овој " + weekday + " вo' p";
  35. }
  36. }
  37. function _nextWeek(day) {
  38. var weekday = weekdays[day];
  39. switch (day) {
  40. case 0:
  41. case 3:
  42. case 6:
  43. return "'следната " + weekday + " вo' p";
  44. case 1:
  45. case 2:
  46. case 4:
  47. case 5:
  48. return "'следниот " + weekday + " вo' p";
  49. }
  50. }
  51. var formatRelativeLocale = {
  52. lastWeek: function lastWeek(date, baseDate, options) {
  53. var day = date.getUTCDay();
  54. if ((0, _index.default)(date, baseDate, options)) {
  55. return thisWeek(day);
  56. } else {
  57. return _lastWeek(day);
  58. }
  59. },
  60. yesterday: "'вчера во' p",
  61. today: "'денес во' p",
  62. tomorrow: "'утре во' p",
  63. nextWeek: function nextWeek(date, baseDate, options) {
  64. var day = date.getUTCDay();
  65. if ((0, _index.default)(date, baseDate, options)) {
  66. return thisWeek(day);
  67. } else {
  68. return _nextWeek(day);
  69. }
  70. },
  71. other: 'P'
  72. };
  73. var formatRelative = function formatRelative(token, date, baseDate, options) {
  74. var format = formatRelativeLocale[token];
  75. if (typeof format === 'function') {
  76. return format(date, baseDate, options);
  77. }
  78. return format;
  79. };
  80. var _default = formatRelative;
  81. exports.default = _default;
  82. module.exports = exports.default;