index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 accusativeWeekdays = ['жексенбіде', 'дүйсенбіде', 'сейсенбіде', 'сәрсенбіде', 'бейсенбіде', 'жұмада', 'сенбіде'];
  9. function _lastWeek(day) {
  10. var weekday = accusativeWeekdays[day];
  11. return "'өткен " + weekday + " сағат' p'-де'";
  12. }
  13. function thisWeek(day) {
  14. var weekday = accusativeWeekdays[day];
  15. return "'" + weekday + " сағат' p'-де'";
  16. }
  17. function _nextWeek(day) {
  18. var weekday = accusativeWeekdays[day];
  19. return "'келесі " + weekday + " сағат' p'-де'";
  20. }
  21. var formatRelativeLocale = {
  22. lastWeek: function lastWeek(date, baseDate, options) {
  23. var day = date.getUTCDay();
  24. if ((0, _index.default)(date, baseDate, options)) {
  25. return thisWeek(day);
  26. } else {
  27. return _lastWeek(day);
  28. }
  29. },
  30. yesterday: "'кеше сағат' p'-де'",
  31. today: "'бүгін сағат' p'-де'",
  32. tomorrow: "'ертең сағат' p'-де'",
  33. nextWeek: function nextWeek(date, baseDate, options) {
  34. var day = date.getUTCDay();
  35. if ((0, _index.default)(date, baseDate, options)) {
  36. return thisWeek(day);
  37. } else {
  38. return _nextWeek(day);
  39. }
  40. },
  41. other: 'P'
  42. };
  43. var formatRelative = function formatRelative(token, date, baseDate, options) {
  44. var format = formatRelativeLocale[token];
  45. if (typeof format === 'function') {
  46. return format(date, baseDate, options);
  47. }
  48. return format;
  49. };
  50. var _default = formatRelative;
  51. exports.default = _default;
  52. module.exports = exports.default;