123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
- var eraValues = {
- narrow: ['B', 'A'],
- abbreviated: ['BC', 'AD'],
- wide: ['Before Christ', 'Anno Domini']
- };
- var quarterValues = {
- narrow: ['1', '2', '3', '4'],
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
- };
- // Note: in English, the names of days of the week and months are capitalized.
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
- // Generally, formatted dates should look like they are in the middle of a sentence,
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
- var monthValues = {
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
- };
- var dayValues = {
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
- };
- var dayPeriodValues = {
- narrow: {
- am: 'a',
- pm: 'p',
- midnight: 'mi',
- noon: 'n',
- morning: 'morning',
- afternoon: 'afternoon',
- evening: 'evening',
- night: 'night'
- },
- abbreviated: {
- am: 'AM',
- pm: 'PM',
- midnight: 'midnight',
- noon: 'noon',
- morning: 'morning',
- afternoon: 'afternoon',
- evening: 'evening',
- night: 'night'
- },
- wide: {
- am: 'a.m.',
- pm: 'p.m.',
- midnight: 'midnight',
- noon: 'noon',
- morning: 'morning',
- afternoon: 'afternoon',
- evening: 'evening',
- night: 'night'
- }
- };
- var formattingDayPeriodValues = {
- narrow: {
- am: 'a',
- pm: 'p',
- midnight: 'mi',
- noon: 'n',
- morning: 'in the morning',
- afternoon: 'in the afternoon',
- evening: 'in the evening',
- night: 'at night'
- },
- abbreviated: {
- am: 'AM',
- pm: 'PM',
- midnight: 'midnight',
- noon: 'noon',
- morning: 'in the morning',
- afternoon: 'in the afternoon',
- evening: 'in the evening',
- night: 'at night'
- },
- wide: {
- am: 'a.m.',
- pm: 'p.m.',
- midnight: 'midnight',
- noon: 'noon',
- morning: 'in the morning',
- afternoon: 'in the afternoon',
- evening: 'in the evening',
- night: 'at night'
- }
- };
- var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
- var number = Number(dirtyNumber);
- // If ordinal numbers depend on context, for example,
- // if they are different for different grammatical genders,
- // use `options.unit`.
- //
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
- // 'day', 'hour', 'minute', 'second'.
- var rem100 = number % 100;
- if (rem100 > 20 || rem100 < 10) {
- switch (rem100 % 10) {
- case 1:
- return number + 'st';
- case 2:
- return number + 'nd';
- case 3:
- return number + 'rd';
- }
- }
- return number + 'th';
- };
- var localize = {
- ordinalNumber: ordinalNumber,
- era: (0, _index.default)({
- values: eraValues,
- defaultWidth: 'wide'
- }),
- quarter: (0, _index.default)({
- values: quarterValues,
- defaultWidth: 'wide',
- argumentCallback: function argumentCallback(quarter) {
- return quarter - 1;
- }
- }),
- month: (0, _index.default)({
- values: monthValues,
- defaultWidth: 'wide'
- }),
- day: (0, _index.default)({
- values: dayValues,
- defaultWidth: 'wide'
- }),
- dayPeriod: (0, _index.default)({
- values: dayPeriodValues,
- defaultWidth: 'wide',
- formattingValues: formattingDayPeriodValues,
- defaultFormattingWidth: 'wide'
- })
- };
- var _default = localize;
- exports.default = _default;
- module.exports = exports.default;
|