diff options
Diffstat (limited to 'date-fns/src/locale/fil/_lib/match/index.js')
-rw-r--r-- | date-fns/src/locale/fil/_lib/match/index.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/date-fns/src/locale/fil/_lib/match/index.js b/date-fns/src/locale/fil/_lib/match/index.js new file mode 100644 index 0000000..5a3f4c5 --- /dev/null +++ b/date-fns/src/locale/fil/_lib/match/index.js @@ -0,0 +1,60 @@ +import buildMatchFn from '../../../_lib/buildMatchFn/index' +import buildParseFn from '../../../_lib/buildParseFn/index' +import buildMatchPatternFn from '../../../_lib/buildMatchPatternFn/index' +import parseDecimal from '../../../_lib/parseDecimal/index' + +var matchOrdinalNumbersPattern = /^(\d+)(th|st|nd|rd)?/i + +var matchWeekdaysPatterns = { + narrow: /^(su|mo|tu|we|th|fr|sa)/i, + short: /^(sun|mon|tue|wed|thu|fri|sat)/i, + long: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i +} + +var parseWeekdayPatterns = { + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] +} + +var matchMonthsPatterns = { + short: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, + long: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i +} + +var parseMonthPatterns = { + any: [ + /^ja/i, + /^f/i, + /^mar/i, + /^ap/i, + /^may/i, + /^jun/i, + /^jul/i, + /^au/i, + /^s/i, + /^o/i, + /^n/i, + /^d/i + ] +} + +var matchTimesOfDayPatterns = { + short: /^(am|pm)/i, + long: /^([ap]\.?\s?m\.?)/i +} + +var parseTimeOfDayPatterns = { + any: [/^a/i, /^p/i] +} + +var match = { + ordinalNumbers: buildMatchPatternFn(matchOrdinalNumbersPattern), + ordinalNumber: parseDecimal, + weekdays: buildMatchFn(matchWeekdaysPatterns, 'long'), + weekday: buildParseFn(parseWeekdayPatterns, 'any'), + months: buildMatchFn(matchMonthsPatterns, 'long'), + month: buildParseFn(parseMonthPatterns, 'any'), + timesOfDay: buildMatchFn(matchTimesOfDayPatterns, 'long'), + timeOfDay: buildParseFn(parseTimeOfDayPatterns, 'any') +} + +export default match |