v1.0 with SW PWA enabled
This commit is contained in:
2
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.d.mts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.d.mts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatDistanceFn } from "../../types.js";
|
||||
export declare const formatDistance: FormatDistanceFn;
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.d.ts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatDistanceFn } from "../../types.js";
|
||||
export declare const formatDistance: FormatDistanceFn;
|
||||
105
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.js
generated
vendored
Normal file
105
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.js
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
exports.formatDistance = void 0;
|
||||
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "dưới 1 giây",
|
||||
other: "dưới {{count}} giây",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 giây",
|
||||
other: "{{count}} giây",
|
||||
},
|
||||
|
||||
halfAMinute: "nửa phút",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "dưới 1 phút",
|
||||
other: "dưới {{count}} phút",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "1 phút",
|
||||
other: "{{count}} phút",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "khoảng 1 giờ",
|
||||
other: "khoảng {{count}} giờ",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 giờ",
|
||||
other: "{{count}} giờ",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 ngày",
|
||||
other: "{{count}} ngày",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "khoảng 1 tuần",
|
||||
other: "khoảng {{count}} tuần",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 tuần",
|
||||
other: "{{count}} tuần",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "khoảng 1 tháng",
|
||||
other: "khoảng {{count}} tháng",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 tháng",
|
||||
other: "{{count}} tháng",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "khoảng 1 năm",
|
||||
other: "khoảng {{count}} năm",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 năm",
|
||||
other: "{{count}} năm",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "hơn 1 năm",
|
||||
other: "hơn {{count}} năm",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "gần 1 năm",
|
||||
other: "gần {{count}} năm",
|
||||
},
|
||||
};
|
||||
|
||||
const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return result + " nữa";
|
||||
} else {
|
||||
return result + " trước";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
exports.formatDistance = formatDistance;
|
||||
101
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.mjs
generated
vendored
Normal file
101
frontend/node_modules/date-fns/locale/vi/_lib/formatDistance.mjs
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
const formatDistanceLocale = {
|
||||
lessThanXSeconds: {
|
||||
one: "dưới 1 giây",
|
||||
other: "dưới {{count}} giây",
|
||||
},
|
||||
|
||||
xSeconds: {
|
||||
one: "1 giây",
|
||||
other: "{{count}} giây",
|
||||
},
|
||||
|
||||
halfAMinute: "nửa phút",
|
||||
|
||||
lessThanXMinutes: {
|
||||
one: "dưới 1 phút",
|
||||
other: "dưới {{count}} phút",
|
||||
},
|
||||
|
||||
xMinutes: {
|
||||
one: "1 phút",
|
||||
other: "{{count}} phút",
|
||||
},
|
||||
|
||||
aboutXHours: {
|
||||
one: "khoảng 1 giờ",
|
||||
other: "khoảng {{count}} giờ",
|
||||
},
|
||||
|
||||
xHours: {
|
||||
one: "1 giờ",
|
||||
other: "{{count}} giờ",
|
||||
},
|
||||
|
||||
xDays: {
|
||||
one: "1 ngày",
|
||||
other: "{{count}} ngày",
|
||||
},
|
||||
|
||||
aboutXWeeks: {
|
||||
one: "khoảng 1 tuần",
|
||||
other: "khoảng {{count}} tuần",
|
||||
},
|
||||
|
||||
xWeeks: {
|
||||
one: "1 tuần",
|
||||
other: "{{count}} tuần",
|
||||
},
|
||||
|
||||
aboutXMonths: {
|
||||
one: "khoảng 1 tháng",
|
||||
other: "khoảng {{count}} tháng",
|
||||
},
|
||||
|
||||
xMonths: {
|
||||
one: "1 tháng",
|
||||
other: "{{count}} tháng",
|
||||
},
|
||||
|
||||
aboutXYears: {
|
||||
one: "khoảng 1 năm",
|
||||
other: "khoảng {{count}} năm",
|
||||
},
|
||||
|
||||
xYears: {
|
||||
one: "1 năm",
|
||||
other: "{{count}} năm",
|
||||
},
|
||||
|
||||
overXYears: {
|
||||
one: "hơn 1 năm",
|
||||
other: "hơn {{count}} năm",
|
||||
},
|
||||
|
||||
almostXYears: {
|
||||
one: "gần 1 năm",
|
||||
other: "gần {{count}} năm",
|
||||
},
|
||||
};
|
||||
|
||||
export const formatDistance = (token, count, options) => {
|
||||
let result;
|
||||
|
||||
const tokenValue = formatDistanceLocale[token];
|
||||
if (typeof tokenValue === "string") {
|
||||
result = tokenValue;
|
||||
} else if (count === 1) {
|
||||
result = tokenValue.one;
|
||||
} else {
|
||||
result = tokenValue.other.replace("{{count}}", String(count));
|
||||
}
|
||||
|
||||
if (options?.addSuffix) {
|
||||
if (options.comparison && options.comparison > 0) {
|
||||
return result + " nữa";
|
||||
} else {
|
||||
return result + " trước";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.d.mts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.d.mts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatLong } from "../../types.js";
|
||||
export declare const formatLong: FormatLong;
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.d.ts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatLong } from "../../types.js";
|
||||
export declare const formatLong: FormatLong;
|
||||
47
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.js
generated
vendored
Normal file
47
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
exports.formatLong = void 0;
|
||||
var _index = require("../../_lib/buildFormatLongFn.js");
|
||||
|
||||
const dateFormats = {
|
||||
// thứ Sáu, ngày 25 tháng 08 năm 2017
|
||||
full: "EEEE, 'ngày' d MMMM 'năm' y",
|
||||
// ngày 25 tháng 08 năm 2017
|
||||
long: "'ngày' d MMMM 'năm' y",
|
||||
// 25 thg 08 năm 2017
|
||||
medium: "d MMM 'năm' y",
|
||||
// 25/08/2017
|
||||
short: "dd/MM/y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss zzzz",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
// thứ Sáu, ngày 25 tháng 08 năm 2017 23:25:59
|
||||
full: "{{date}} {{time}}",
|
||||
// ngày 25 tháng 08 năm 2017 23:25
|
||||
long: "{{date}} {{time}}",
|
||||
medium: "{{date}} {{time}}",
|
||||
short: "{{date}} {{time}}",
|
||||
};
|
||||
|
||||
const formatLong = (exports.formatLong = {
|
||||
date: (0, _index.buildFormatLongFn)({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: (0, _index.buildFormatLongFn)({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: (0, _index.buildFormatLongFn)({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
});
|
||||
45
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.mjs
generated
vendored
Normal file
45
frontend/node_modules/date-fns/locale/vi/_lib/formatLong.mjs
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { buildFormatLongFn } from "../../_lib/buildFormatLongFn.mjs";
|
||||
|
||||
const dateFormats = {
|
||||
// thứ Sáu, ngày 25 tháng 08 năm 2017
|
||||
full: "EEEE, 'ngày' d MMMM 'năm' y",
|
||||
// ngày 25 tháng 08 năm 2017
|
||||
long: "'ngày' d MMMM 'năm' y",
|
||||
// 25 thg 08 năm 2017
|
||||
medium: "d MMM 'năm' y",
|
||||
// 25/08/2017
|
||||
short: "dd/MM/y",
|
||||
};
|
||||
|
||||
const timeFormats = {
|
||||
full: "HH:mm:ss zzzz",
|
||||
long: "HH:mm:ss z",
|
||||
medium: "HH:mm:ss",
|
||||
short: "HH:mm",
|
||||
};
|
||||
|
||||
const dateTimeFormats = {
|
||||
// thứ Sáu, ngày 25 tháng 08 năm 2017 23:25:59
|
||||
full: "{{date}} {{time}}",
|
||||
// ngày 25 tháng 08 năm 2017 23:25
|
||||
long: "{{date}} {{time}}",
|
||||
medium: "{{date}} {{time}}",
|
||||
short: "{{date}} {{time}}",
|
||||
};
|
||||
|
||||
export const formatLong = {
|
||||
date: buildFormatLongFn({
|
||||
formats: dateFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
time: buildFormatLongFn({
|
||||
formats: timeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
|
||||
dateTime: buildFormatLongFn({
|
||||
formats: dateTimeFormats,
|
||||
defaultWidth: "full",
|
||||
}),
|
||||
};
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.d.mts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.d.mts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatRelativeFn } from "../../types.js";
|
||||
export declare const formatRelative: FormatRelativeFn;
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.d.ts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { FormatRelativeFn } from "../../types.js";
|
||||
export declare const formatRelative: FormatRelativeFn;
|
||||
15
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.js
generated
vendored
Normal file
15
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
exports.formatRelative = void 0;
|
||||
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "eeee 'tuần trước vào lúc' p",
|
||||
yesterday: "'hôm qua vào lúc' p",
|
||||
today: "'hôm nay vào lúc' p",
|
||||
tomorrow: "'ngày mai vào lúc' p",
|
||||
nextWeek: "eeee 'tới vào lúc' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
exports.formatRelative = formatRelative;
|
||||
11
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.mjs
generated
vendored
Normal file
11
frontend/node_modules/date-fns/locale/vi/_lib/formatRelative.mjs
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
const formatRelativeLocale = {
|
||||
lastWeek: "eeee 'tuần trước vào lúc' p",
|
||||
yesterday: "'hôm qua vào lúc' p",
|
||||
today: "'hôm nay vào lúc' p",
|
||||
tomorrow: "'ngày mai vào lúc' p",
|
||||
nextWeek: "eeee 'tới vào lúc' p",
|
||||
other: "P",
|
||||
};
|
||||
|
||||
export const formatRelative = (token, _date, _baseDate, _options) =>
|
||||
formatRelativeLocale[token];
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/localize.d.mts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/localize.d.mts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { Localize } from "../../types.js";
|
||||
export declare const localize: Localize;
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/localize.d.ts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/localize.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { Localize } from "../../types.js";
|
||||
export declare const localize: Localize;
|
||||
288
frontend/node_modules/date-fns/locale/vi/_lib/localize.js
generated
vendored
Normal file
288
frontend/node_modules/date-fns/locale/vi/_lib/localize.js
generated
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
exports.localize = void 0;
|
||||
var _index = require("../../_lib/buildLocalizeFn.js");
|
||||
|
||||
// Vietnamese locale reference: http://www.localeplanet.com/icu/vi-VN/index.html
|
||||
// Capitalization reference: http://hcmup.edu.vn/index.php?option=com_content&view=article&id=4106%3Avit-hoa-trong-vn-bn-hanh-chinh&catid=2345%3Atham-kho&Itemid=4103&lang=vi&site=134
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["TCN", "SCN"],
|
||||
abbreviated: ["trước CN", "sau CN"],
|
||||
wide: ["trước Công Nguyên", "sau Công Nguyên"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
||||
wide: ["Quý 1", "Quý 2", "Quý 3", "Quý 4"],
|
||||
};
|
||||
|
||||
const formattingQuarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
||||
// I notice many news outlet use this "quý II/2018"
|
||||
wide: ["quý I", "quý II", "quý III", "quý IV"],
|
||||
};
|
||||
|
||||
// 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.
|
||||
const monthValues = {
|
||||
narrow: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
||||
|
||||
abbreviated: [
|
||||
"Thg 1",
|
||||
"Thg 2",
|
||||
"Thg 3",
|
||||
"Thg 4",
|
||||
"Thg 5",
|
||||
"Thg 6",
|
||||
"Thg 7",
|
||||
"Thg 8",
|
||||
"Thg 9",
|
||||
"Thg 10",
|
||||
"Thg 11",
|
||||
"Thg 12",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"Tháng Một",
|
||||
"Tháng Hai",
|
||||
"Tháng Ba",
|
||||
"Tháng Tư",
|
||||
"Tháng Năm",
|
||||
"Tháng Sáu",
|
||||
"Tháng Bảy",
|
||||
"Tháng Tám",
|
||||
"Tháng Chín",
|
||||
"Tháng Mười",
|
||||
"Tháng Mười Một",
|
||||
"Tháng Mười Hai",
|
||||
],
|
||||
};
|
||||
// In Vietnamese date formatting, month number less than 10 expected to have leading zero
|
||||
const formattingMonthValues = {
|
||||
narrow: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"05",
|
||||
"06",
|
||||
"07",
|
||||
"08",
|
||||
"09",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"thg 1",
|
||||
"thg 2",
|
||||
"thg 3",
|
||||
"thg 4",
|
||||
"thg 5",
|
||||
"thg 6",
|
||||
"thg 7",
|
||||
"thg 8",
|
||||
"thg 9",
|
||||
"thg 10",
|
||||
"thg 11",
|
||||
"thg 12",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"tháng 01",
|
||||
"tháng 02",
|
||||
"tháng 03",
|
||||
"tháng 04",
|
||||
"tháng 05",
|
||||
"tháng 06",
|
||||
"tháng 07",
|
||||
"tháng 08",
|
||||
"tháng 09",
|
||||
"tháng 10",
|
||||
"tháng 11",
|
||||
"tháng 12",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"],
|
||||
short: ["CN", "Th 2", "Th 3", "Th 4", "Th 5", "Th 6", "Th 7"],
|
||||
abbreviated: ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"],
|
||||
|
||||
wide: [
|
||||
"Chủ Nhật",
|
||||
"Thứ Hai",
|
||||
"Thứ Ba",
|
||||
"Thứ Tư",
|
||||
"Thứ Năm",
|
||||
"Thứ Sáu",
|
||||
"Thứ Bảy",
|
||||
],
|
||||
};
|
||||
|
||||
// Vietnamese are used to AM/PM borrowing from English, hence `narrow` and
|
||||
// `abbreviated` are just like English but I'm leaving the `wide`
|
||||
// format being localized with abbreviations found in some systems (SÁng / CHiều);
|
||||
// however, personally, I don't think `Chiều` sounds appropriate for `PM`
|
||||
const dayPeriodValues = {
|
||||
// narrow date period is extremely rare in Vietnamese
|
||||
// I used abbreviated form for noon, morning and afternoon
|
||||
// which are regconizable by Vietnamese, others cannot be any shorter
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "nửa đêm",
|
||||
noon: "tr",
|
||||
morning: "sg",
|
||||
afternoon: "ch",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
wide: {
|
||||
am: "SA",
|
||||
pm: "CH",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "nửa đêm",
|
||||
noon: "tr",
|
||||
morning: "sg",
|
||||
afternoon: "ch",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
wide: {
|
||||
am: "SA",
|
||||
pm: "CH",
|
||||
midnight: "nửa đêm",
|
||||
noon: "giữa trưa",
|
||||
morning: "vào buổi sáng",
|
||||
afternoon: "vào buổi chiều",
|
||||
evening: "vào buổi tối",
|
||||
night: "vào ban đêm",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const unit = options?.unit;
|
||||
|
||||
if (unit === "quarter") {
|
||||
// many news outlets use "quý I"...
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "I";
|
||||
case 2:
|
||||
return "II";
|
||||
case 3:
|
||||
return "III";
|
||||
case 4:
|
||||
return "IV";
|
||||
}
|
||||
} else if (unit === "day") {
|
||||
// day of week in Vietnamese has ordinal number meaning,
|
||||
// so we should use them, else it'll sound weird
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "thứ 2"; // meaning 2nd day but it's the first day of the week :D
|
||||
case 2:
|
||||
return "thứ 3"; // meaning 3rd day
|
||||
case 3:
|
||||
return "thứ 4"; // meaning 4th day and so on
|
||||
case 4:
|
||||
return "thứ 5";
|
||||
case 5:
|
||||
return "thứ 6";
|
||||
case 6:
|
||||
return "thứ 7";
|
||||
case 7:
|
||||
return "chủ nhật"; // meaning Sunday, there's no 8th day :D
|
||||
}
|
||||
} else if (unit === "week") {
|
||||
if (number === 1) {
|
||||
return "thứ nhất";
|
||||
} else {
|
||||
return "thứ " + number;
|
||||
}
|
||||
} else if (unit === "dayOfYear") {
|
||||
if (number === 1) {
|
||||
return "đầu tiên";
|
||||
} else {
|
||||
return "thứ " + number;
|
||||
}
|
||||
}
|
||||
|
||||
// there are no different forms of ordinal numbers in Vietnamese
|
||||
return String(number);
|
||||
};
|
||||
|
||||
const localize = (exports.localize = {
|
||||
ordinalNumber,
|
||||
|
||||
era: (0, _index.buildLocalizeFn)({
|
||||
values: eraValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
quarter: (0, _index.buildLocalizeFn)({
|
||||
values: quarterValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingQuarterValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
argumentCallback: (quarter) => quarter - 1,
|
||||
}),
|
||||
|
||||
month: (0, _index.buildLocalizeFn)({
|
||||
values: monthValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: (0, _index.buildLocalizeFn)({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: (0, _index.buildLocalizeFn)({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
});
|
||||
286
frontend/node_modules/date-fns/locale/vi/_lib/localize.mjs
generated
vendored
Normal file
286
frontend/node_modules/date-fns/locale/vi/_lib/localize.mjs
generated
vendored
Normal file
@ -0,0 +1,286 @@
|
||||
import { buildLocalizeFn } from "../../_lib/buildLocalizeFn.mjs";
|
||||
|
||||
// Vietnamese locale reference: http://www.localeplanet.com/icu/vi-VN/index.html
|
||||
// Capitalization reference: http://hcmup.edu.vn/index.php?option=com_content&view=article&id=4106%3Avit-hoa-trong-vn-bn-hanh-chinh&catid=2345%3Atham-kho&Itemid=4103&lang=vi&site=134
|
||||
|
||||
const eraValues = {
|
||||
narrow: ["TCN", "SCN"],
|
||||
abbreviated: ["trước CN", "sau CN"],
|
||||
wide: ["trước Công Nguyên", "sau Công Nguyên"],
|
||||
};
|
||||
|
||||
const quarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
||||
wide: ["Quý 1", "Quý 2", "Quý 3", "Quý 4"],
|
||||
};
|
||||
|
||||
const formattingQuarterValues = {
|
||||
narrow: ["1", "2", "3", "4"],
|
||||
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
||||
// I notice many news outlet use this "quý II/2018"
|
||||
wide: ["quý I", "quý II", "quý III", "quý IV"],
|
||||
};
|
||||
|
||||
// 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.
|
||||
const monthValues = {
|
||||
narrow: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
||||
|
||||
abbreviated: [
|
||||
"Thg 1",
|
||||
"Thg 2",
|
||||
"Thg 3",
|
||||
"Thg 4",
|
||||
"Thg 5",
|
||||
"Thg 6",
|
||||
"Thg 7",
|
||||
"Thg 8",
|
||||
"Thg 9",
|
||||
"Thg 10",
|
||||
"Thg 11",
|
||||
"Thg 12",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"Tháng Một",
|
||||
"Tháng Hai",
|
||||
"Tháng Ba",
|
||||
"Tháng Tư",
|
||||
"Tháng Năm",
|
||||
"Tháng Sáu",
|
||||
"Tháng Bảy",
|
||||
"Tháng Tám",
|
||||
"Tháng Chín",
|
||||
"Tháng Mười",
|
||||
"Tháng Mười Một",
|
||||
"Tháng Mười Hai",
|
||||
],
|
||||
};
|
||||
// In Vietnamese date formatting, month number less than 10 expected to have leading zero
|
||||
const formattingMonthValues = {
|
||||
narrow: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"05",
|
||||
"06",
|
||||
"07",
|
||||
"08",
|
||||
"09",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
"thg 1",
|
||||
"thg 2",
|
||||
"thg 3",
|
||||
"thg 4",
|
||||
"thg 5",
|
||||
"thg 6",
|
||||
"thg 7",
|
||||
"thg 8",
|
||||
"thg 9",
|
||||
"thg 10",
|
||||
"thg 11",
|
||||
"thg 12",
|
||||
],
|
||||
|
||||
wide: [
|
||||
"tháng 01",
|
||||
"tháng 02",
|
||||
"tháng 03",
|
||||
"tháng 04",
|
||||
"tháng 05",
|
||||
"tháng 06",
|
||||
"tháng 07",
|
||||
"tháng 08",
|
||||
"tháng 09",
|
||||
"tháng 10",
|
||||
"tháng 11",
|
||||
"tháng 12",
|
||||
],
|
||||
};
|
||||
|
||||
const dayValues = {
|
||||
narrow: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"],
|
||||
short: ["CN", "Th 2", "Th 3", "Th 4", "Th 5", "Th 6", "Th 7"],
|
||||
abbreviated: ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"],
|
||||
|
||||
wide: [
|
||||
"Chủ Nhật",
|
||||
"Thứ Hai",
|
||||
"Thứ Ba",
|
||||
"Thứ Tư",
|
||||
"Thứ Năm",
|
||||
"Thứ Sáu",
|
||||
"Thứ Bảy",
|
||||
],
|
||||
};
|
||||
|
||||
// Vietnamese are used to AM/PM borrowing from English, hence `narrow` and
|
||||
// `abbreviated` are just like English but I'm leaving the `wide`
|
||||
// format being localized with abbreviations found in some systems (SÁng / CHiều);
|
||||
// however, personally, I don't think `Chiều` sounds appropriate for `PM`
|
||||
const dayPeriodValues = {
|
||||
// narrow date period is extremely rare in Vietnamese
|
||||
// I used abbreviated form for noon, morning and afternoon
|
||||
// which are regconizable by Vietnamese, others cannot be any shorter
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "nửa đêm",
|
||||
noon: "tr",
|
||||
morning: "sg",
|
||||
afternoon: "ch",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
wide: {
|
||||
am: "SA",
|
||||
pm: "CH",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
};
|
||||
|
||||
const formattingDayPeriodValues = {
|
||||
narrow: {
|
||||
am: "am",
|
||||
pm: "pm",
|
||||
midnight: "nửa đêm",
|
||||
noon: "tr",
|
||||
morning: "sg",
|
||||
afternoon: "ch",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
abbreviated: {
|
||||
am: "AM",
|
||||
pm: "PM",
|
||||
midnight: "nửa đêm",
|
||||
noon: "trưa",
|
||||
morning: "sáng",
|
||||
afternoon: "chiều",
|
||||
evening: "tối",
|
||||
night: "đêm",
|
||||
},
|
||||
wide: {
|
||||
am: "SA",
|
||||
pm: "CH",
|
||||
midnight: "nửa đêm",
|
||||
noon: "giữa trưa",
|
||||
morning: "vào buổi sáng",
|
||||
afternoon: "vào buổi chiều",
|
||||
evening: "vào buổi tối",
|
||||
night: "vào ban đêm",
|
||||
},
|
||||
};
|
||||
|
||||
const ordinalNumber = (dirtyNumber, options) => {
|
||||
const number = Number(dirtyNumber);
|
||||
const unit = options?.unit;
|
||||
|
||||
if (unit === "quarter") {
|
||||
// many news outlets use "quý I"...
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "I";
|
||||
case 2:
|
||||
return "II";
|
||||
case 3:
|
||||
return "III";
|
||||
case 4:
|
||||
return "IV";
|
||||
}
|
||||
} else if (unit === "day") {
|
||||
// day of week in Vietnamese has ordinal number meaning,
|
||||
// so we should use them, else it'll sound weird
|
||||
switch (number) {
|
||||
case 1:
|
||||
return "thứ 2"; // meaning 2nd day but it's the first day of the week :D
|
||||
case 2:
|
||||
return "thứ 3"; // meaning 3rd day
|
||||
case 3:
|
||||
return "thứ 4"; // meaning 4th day and so on
|
||||
case 4:
|
||||
return "thứ 5";
|
||||
case 5:
|
||||
return "thứ 6";
|
||||
case 6:
|
||||
return "thứ 7";
|
||||
case 7:
|
||||
return "chủ nhật"; // meaning Sunday, there's no 8th day :D
|
||||
}
|
||||
} else if (unit === "week") {
|
||||
if (number === 1) {
|
||||
return "thứ nhất";
|
||||
} else {
|
||||
return "thứ " + number;
|
||||
}
|
||||
} else if (unit === "dayOfYear") {
|
||||
if (number === 1) {
|
||||
return "đầu tiên";
|
||||
} else {
|
||||
return "thứ " + number;
|
||||
}
|
||||
}
|
||||
|
||||
// there are no different forms of ordinal numbers in Vietnamese
|
||||
return String(number);
|
||||
};
|
||||
|
||||
export const localize = {
|
||||
ordinalNumber,
|
||||
|
||||
era: buildLocalizeFn({
|
||||
values: eraValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
quarter: buildLocalizeFn({
|
||||
values: quarterValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingQuarterValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
argumentCallback: (quarter) => quarter - 1,
|
||||
}),
|
||||
|
||||
month: buildLocalizeFn({
|
||||
values: monthValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingMonthValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
|
||||
day: buildLocalizeFn({
|
||||
values: dayValues,
|
||||
defaultWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildLocalizeFn({
|
||||
values: dayPeriodValues,
|
||||
defaultWidth: "wide",
|
||||
formattingValues: formattingDayPeriodValues,
|
||||
defaultFormattingWidth: "wide",
|
||||
}),
|
||||
};
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/match.d.mts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/match.d.mts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { Match } from "../../types.js";
|
||||
export declare const match: Match;
|
||||
2
frontend/node_modules/date-fns/locale/vi/_lib/match.d.ts
generated
vendored
Normal file
2
frontend/node_modules/date-fns/locale/vi/_lib/match.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import type { Match } from "../../types.js";
|
||||
export declare const match: Match;
|
||||
157
frontend/node_modules/date-fns/locale/vi/_lib/match.js
generated
vendored
Normal file
157
frontend/node_modules/date-fns/locale/vi/_lib/match.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
exports.match = void 0;
|
||||
|
||||
var _index = require("../../_lib/buildMatchFn.js");
|
||||
var _index2 = require("../../_lib/buildMatchPatternFn.js");
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(tcn|scn)/i,
|
||||
abbreviated: /^(trước CN|sau CN)/i,
|
||||
wide: /^(trước Công Nguyên|sau Công Nguyên)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^t/i, /^s/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^([1234]|i{1,3}v?)/i,
|
||||
abbreviated: /^q([1234]|i{1,3}v?)/i,
|
||||
wide: /^quý ([1234]|i{1,3}v?)/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/(1|i)$/i, /(2|ii)$/i, /(3|iii)$/i, /(4|iv)$/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
// month number may contain leading 0, 'thg' prefix may have space, underscore or empty before number
|
||||
// note the order of '1' since it is a sub-string of '10', so must be lower priority
|
||||
narrow: /^(0?[2-9]|10|11|12|0?1)/i,
|
||||
// note the order of 'thg 1' since it is sub-string of 'thg 10', so must be lower priority
|
||||
abbreviated: /^thg[ _]?(0?[1-9](?!\d)|10|11|12)/i,
|
||||
// note the order of 'Mười' since it is sub-string of Mười Một, so must be lower priority
|
||||
wide: /^tháng ?(Một|Hai|Ba|Tư|Năm|Sáu|Bảy|Tám|Chín|Mười|Mười ?Một|Mười ?Hai|0?[1-9](?!\d)|10|11|12)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/0?1$/i,
|
||||
/0?2/i,
|
||||
/3/,
|
||||
/4/,
|
||||
/5/,
|
||||
/6/,
|
||||
/7/,
|
||||
/8/,
|
||||
/9/,
|
||||
/10/,
|
||||
/11/,
|
||||
/12/,
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
/^thg[ _]?0?1(?!\d)/i,
|
||||
/^thg[ _]?0?2/i,
|
||||
/^thg[ _]?0?3/i,
|
||||
/^thg[ _]?0?4/i,
|
||||
/^thg[ _]?0?5/i,
|
||||
/^thg[ _]?0?6/i,
|
||||
/^thg[ _]?0?7/i,
|
||||
/^thg[ _]?0?8/i,
|
||||
/^thg[ _]?0?9/i,
|
||||
/^thg[ _]?10/i,
|
||||
/^thg[ _]?11/i,
|
||||
/^thg[ _]?12/i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^tháng ?(Một|0?1(?!\d))/i,
|
||||
/^tháng ?(Hai|0?2)/i,
|
||||
/^tháng ?(Ba|0?3)/i,
|
||||
/^tháng ?(Tư|0?4)/i,
|
||||
/^tháng ?(Năm|0?5)/i,
|
||||
/^tháng ?(Sáu|0?6)/i,
|
||||
/^tháng ?(Bảy|0?7)/i,
|
||||
/^tháng ?(Tám|0?8)/i,
|
||||
/^tháng ?(Chín|0?9)/i,
|
||||
/^tháng ?(Mười|10)/i,
|
||||
/^tháng ?(Mười ?Một|11)/i,
|
||||
/^tháng ?(Mười ?Hai|12)/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(CN|T2|T3|T4|T5|T6|T7)/i,
|
||||
short: /^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,
|
||||
abbreviated: /^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,
|
||||
wide: /^(Chủ ?Nhật|Chúa ?Nhật|thứ ?Hai|thứ ?Ba|thứ ?Tư|thứ ?Năm|thứ ?Sáu|thứ ?Bảy)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
short: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
abbreviated: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
wide: [/(Chủ|Chúa) ?Nhật/i, /Hai/i, /Ba/i, /Tư/i, /Năm/i, /Sáu/i, /Bảy/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
abbreviated: /^(am|pm|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
wide: /^(ch[^i]*|sa|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^(a|sa)/i,
|
||||
pm: /^(p|ch[^i]*)/i,
|
||||
midnight: /nửa đêm/i,
|
||||
noon: /trưa/i,
|
||||
morning: /sáng/i,
|
||||
afternoon: /chiều/i,
|
||||
evening: /tối/i,
|
||||
night: /^đêm/i,
|
||||
},
|
||||
};
|
||||
|
||||
const match = (exports.match = {
|
||||
ordinalNumber: (0, _index2.buildMatchPatternFn)({
|
||||
matchPattern: matchOrdinalNumberPattern,
|
||||
parsePattern: parseOrdinalNumberPattern,
|
||||
valueCallback: (value) => parseInt(value, 10),
|
||||
}),
|
||||
|
||||
era: (0, _index.buildMatchFn)({
|
||||
matchPatterns: matchEraPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseEraPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
|
||||
quarter: (0, _index.buildMatchFn)({
|
||||
matchPatterns: matchQuarterPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseQuarterPatterns,
|
||||
defaultParseWidth: "any",
|
||||
valueCallback: (index) => index + 1,
|
||||
}),
|
||||
|
||||
month: (0, _index.buildMatchFn)({
|
||||
matchPatterns: matchMonthPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseMonthPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
day: (0, _index.buildMatchFn)({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: (0, _index.buildMatchFn)({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
});
|
||||
154
frontend/node_modules/date-fns/locale/vi/_lib/match.mjs
generated
vendored
Normal file
154
frontend/node_modules/date-fns/locale/vi/_lib/match.mjs
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
import { buildMatchFn } from "../../_lib/buildMatchFn.mjs";
|
||||
import { buildMatchPatternFn } from "../../_lib/buildMatchPatternFn.mjs";
|
||||
|
||||
const matchOrdinalNumberPattern = /^(\d+)/i;
|
||||
const parseOrdinalNumberPattern = /\d+/i;
|
||||
|
||||
const matchEraPatterns = {
|
||||
narrow: /^(tcn|scn)/i,
|
||||
abbreviated: /^(trước CN|sau CN)/i,
|
||||
wide: /^(trước Công Nguyên|sau Công Nguyên)/i,
|
||||
};
|
||||
const parseEraPatterns = {
|
||||
any: [/^t/i, /^s/i],
|
||||
};
|
||||
|
||||
const matchQuarterPatterns = {
|
||||
narrow: /^([1234]|i{1,3}v?)/i,
|
||||
abbreviated: /^q([1234]|i{1,3}v?)/i,
|
||||
wide: /^quý ([1234]|i{1,3}v?)/i,
|
||||
};
|
||||
const parseQuarterPatterns = {
|
||||
any: [/(1|i)$/i, /(2|ii)$/i, /(3|iii)$/i, /(4|iv)$/i],
|
||||
};
|
||||
|
||||
const matchMonthPatterns = {
|
||||
// month number may contain leading 0, 'thg' prefix may have space, underscore or empty before number
|
||||
// note the order of '1' since it is a sub-string of '10', so must be lower priority
|
||||
narrow: /^(0?[2-9]|10|11|12|0?1)/i,
|
||||
// note the order of 'thg 1' since it is sub-string of 'thg 10', so must be lower priority
|
||||
abbreviated: /^thg[ _]?(0?[1-9](?!\d)|10|11|12)/i,
|
||||
// note the order of 'Mười' since it is sub-string of Mười Một, so must be lower priority
|
||||
wide: /^tháng ?(Một|Hai|Ba|Tư|Năm|Sáu|Bảy|Tám|Chín|Mười|Mười ?Một|Mười ?Hai|0?[1-9](?!\d)|10|11|12)/i,
|
||||
};
|
||||
const parseMonthPatterns = {
|
||||
narrow: [
|
||||
/0?1$/i,
|
||||
/0?2/i,
|
||||
/3/,
|
||||
/4/,
|
||||
/5/,
|
||||
/6/,
|
||||
/7/,
|
||||
/8/,
|
||||
/9/,
|
||||
/10/,
|
||||
/11/,
|
||||
/12/,
|
||||
],
|
||||
|
||||
abbreviated: [
|
||||
/^thg[ _]?0?1(?!\d)/i,
|
||||
/^thg[ _]?0?2/i,
|
||||
/^thg[ _]?0?3/i,
|
||||
/^thg[ _]?0?4/i,
|
||||
/^thg[ _]?0?5/i,
|
||||
/^thg[ _]?0?6/i,
|
||||
/^thg[ _]?0?7/i,
|
||||
/^thg[ _]?0?8/i,
|
||||
/^thg[ _]?0?9/i,
|
||||
/^thg[ _]?10/i,
|
||||
/^thg[ _]?11/i,
|
||||
/^thg[ _]?12/i,
|
||||
],
|
||||
|
||||
wide: [
|
||||
/^tháng ?(Một|0?1(?!\d))/i,
|
||||
/^tháng ?(Hai|0?2)/i,
|
||||
/^tháng ?(Ba|0?3)/i,
|
||||
/^tháng ?(Tư|0?4)/i,
|
||||
/^tháng ?(Năm|0?5)/i,
|
||||
/^tháng ?(Sáu|0?6)/i,
|
||||
/^tháng ?(Bảy|0?7)/i,
|
||||
/^tháng ?(Tám|0?8)/i,
|
||||
/^tháng ?(Chín|0?9)/i,
|
||||
/^tháng ?(Mười|10)/i,
|
||||
/^tháng ?(Mười ?Một|11)/i,
|
||||
/^tháng ?(Mười ?Hai|12)/i,
|
||||
],
|
||||
};
|
||||
|
||||
const matchDayPatterns = {
|
||||
narrow: /^(CN|T2|T3|T4|T5|T6|T7)/i,
|
||||
short: /^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,
|
||||
abbreviated: /^(CN|Th ?2|Th ?3|Th ?4|Th ?5|Th ?6|Th ?7)/i,
|
||||
wide: /^(Chủ ?Nhật|Chúa ?Nhật|thứ ?Hai|thứ ?Ba|thứ ?Tư|thứ ?Năm|thứ ?Sáu|thứ ?Bảy)/i,
|
||||
};
|
||||
const parseDayPatterns = {
|
||||
narrow: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
short: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
abbreviated: [/CN/i, /2/i, /3/i, /4/i, /5/i, /6/i, /7/i],
|
||||
wide: [/(Chủ|Chúa) ?Nhật/i, /Hai/i, /Ba/i, /Tư/i, /Năm/i, /Sáu/i, /Bảy/i],
|
||||
};
|
||||
|
||||
const matchDayPeriodPatterns = {
|
||||
narrow: /^(a|p|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
abbreviated: /^(am|pm|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
wide: /^(ch[^i]*|sa|nửa đêm|trưa|(giờ) (sáng|chiều|tối|đêm))/i,
|
||||
};
|
||||
const parseDayPeriodPatterns = {
|
||||
any: {
|
||||
am: /^(a|sa)/i,
|
||||
pm: /^(p|ch[^i]*)/i,
|
||||
midnight: /nửa đêm/i,
|
||||
noon: /trưa/i,
|
||||
morning: /sáng/i,
|
||||
afternoon: /chiều/i,
|
||||
evening: /tối/i,
|
||||
night: /^đêm/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: "wide",
|
||||
}),
|
||||
|
||||
day: buildMatchFn({
|
||||
matchPatterns: matchDayPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPatterns,
|
||||
defaultParseWidth: "wide",
|
||||
}),
|
||||
|
||||
dayPeriod: buildMatchFn({
|
||||
matchPatterns: matchDayPeriodPatterns,
|
||||
defaultMatchWidth: "wide",
|
||||
parsePatterns: parseDayPeriodPatterns,
|
||||
defaultParseWidth: "any",
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user