timepiece/node_modules/date-fns/locale/az/_lib/match.mjs

185 lines
3.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { buildMatchFn } from "../../_lib/buildMatchFn.mjs";
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.mjs";
const matchOrdinalNumberPattern = /^(\d+)(-?(ci|inci|nci|uncu|üncü|ncı))?/i;
const parseOrdinalNumberPattern = /\d+/i;
const matchEraPatterns = {
narrow: /^(b|a)$/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)$/i,
wide: /^(bizim eradan əvvəl|bizim era)$/i,
};
const parseEraPatterns = {
any: [/^b$/i, /^(a|c)$/i],
};
const matchQuarterPatterns = {
narrow: /^[1234]$/i,
abbreviated: /^K[1234]$/i,
wide: /^[1234](ci)? kvartal$/i,
};
const parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i],
};
const matchMonthPatterns = {
narrow: /^[(?-i)yfmaisond]$/i,
abbreviated: /^(Yan|Fev|Mar|Apr|May|İyun|İyul|Avq|Sen|Okt|Noy|Dek)$/i,
wide: /^(Yanvar|Fevral|Mart|Aprel|May|İyun|İyul|Avgust|Sentyabr|Oktyabr|Noyabr|Dekabr)$/i,
};
const parseMonthPatterns = {
narrow: [
/^[(?-i)y]$/i,
/^[(?-i)f]$/i,
/^[(?-i)m]$/i,
/^[(?-i)a]$/i,
/^[(?-i)m]$/i,
/^[(?-i)i]$/i,
/^[(?-i)i]$/i,
/^[(?-i)a]$/i,
/^[(?-i)s]$/i,
/^[(?-i)o]$/i,
/^[(?-i)n]$/i,
/^[(?-i)d]$/i,
],
abbreviated: [
/^Yan$/i,
/^Fev$/i,
/^Mar$/i,
/^Apr$/i,
/^May$/i,
/^İyun$/i,
/^İyul$/i,
/^Avg$/i,
/^Sen$/i,
/^Okt$/i,
/^Noy$/i,
/^Dek$/i,
],
wide: [
/^Yanvar$/i,
/^Fevral$/i,
/^Mart$/i,
/^Aprel$/i,
/^May$/i,
/^İyun$/i,
/^İyul$/i,
/^Avgust$/i,
/^Sentyabr$/i,
/^Oktyabr$/i,
/^Noyabr$/i,
/^Dekabr$/i,
],
};
const matchDayPatterns = {
narrow: /^(B\.|B\.e|Ç\.a|Ç\.|C\.a|C\.|Ş\.)$/i,
short: /^(B\.|B\.e|Ç\.a|Ç\.|C\.a|C\.|Ş\.)$/i,
abbreviated: /^(Baz\.e|Çər|Çər\.a|Cüm|Cüm\.a|Şə)$/i,
wide: /^(Bazar|Bazar ertəsi|Çərşənbə axşamı|Çərşənbə|Cümə axşamı|Cümə|Şənbə)$/i,
};
const parseDayPatterns = {
narrow: [
/^B\.$/i,
/^B\.e$/i,
/^Ç\.a$/i,
/^Ç\.$/i,
/^C\.a$/i,
/^C\.$/i,
/^Ş\.$/i,
],
abbreviated: [
/^Baz$/i,
/^Baz\.e$/i,
/^Çər\.a$/i,
/^Çər$/i,
/^Cüm\.a$/i,
/^Cüm$/i,
/^Şə$/i,
],
wide: [
/^Bazar$/i,
/^Bazar ertəsi$/i,
/^Çərşənbə axşamı$/i,
/^Çərşənbə$/i,
/^Cümə axşamı$/i,
/^Cümə$/i,
/^Şənbə$/i,
],
any: [
/^B\.$/i,
/^B\.e$/i,
/^Ç\.a$/i,
/^Ç\.$/i,
/^C\.a$/i,
/^C\.$/i,
/^Ş\.$/i,
],
};
const matchDayPeriodPatterns = {
narrow: /^(a|p|gecəyarı|gün|səhər|gündüz|axşam|gecə)$/i,
any: /^(am|pm|a\.m\.|p\.m\.|AM|PM|gecəyarı|gün|səhər|gündüz|axşam|gecə)$/i,
};
const parseDayPeriodPatterns = {
any: {
am: /^a$/i,
pm: /^p$/i,
midnight: /^gecəyarı$/i,
noon: /^gün$/i,
morning: /səhər$/i,
afternoon: /gündüz$/i,
evening: /axşam$/i,
night: /gecə$/i,
},
};
export const match = {
ordinalNumber: buildMatchPatternFn({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: (value) => parseInt(value, 10),
}),
era: buildMatchFn({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any",
}),
quarter: buildMatchFn({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: (index) => index + 1,
}),
month: buildMatchFn({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "narrow",
}),
day: buildMatchFn({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any",
}),
dayPeriod: buildMatchFn({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any",
}),
};