Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(dmyDateFormat: boolean) {
this.dateExtractor = new ChineseDateExtractor(dmyDateFormat);
this.timeExtractor = new ChineseTimeExtractor();
this.dateParser = new ChineseDateParser(dmyDateFormat);
this.timeParser = new ChineseTimeParser();
this.pmTimeRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimeSimplePmRegex);
this.amTimeRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimeSimpleAmRegex);
this.specificTimeOfDayRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.TimeOfTodayRegex);
this.nowRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.NowRegex);
this.numberParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Number, new ChineseNumberParserConfiguration());
this.unitRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateUnitRegex);
this.unitMap = ChineseDateTime.ParserConfigurationUnitMap;
}
constructor(dmyDateFormat: boolean) {
let config = new ChineseDateTimePeriodParserConfiguration(dmyDateFormat);
super(config);
this.TMORegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodMORegex);
this.TMIRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodMIRegex);
this.TAFRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodAFRegex);
this.TEVRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodEVRegex);
this.TNIRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodNIRegex);
this.unitRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateTimePeriodUnitRegex);
this.timeOfDayRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.TimeOfDayRegex);
this.cardinalExtractor = new ChineseCardinalExtractor();
this.cardinalParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Cardinal, new ChineseNumberParserConfiguration());
}
constructor(dmyDateFormat: boolean) {
let config = new ChineseDatePeriodParserConfiguration(dmyDateFormat);
super(config, false);
this.integerExtractor = new ChineseIntegerExtractor();
this.numberParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Integer, new ChineseNumberParserConfiguration());
this.yearInChineseRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DatePeriodYearInChineseRegex);
this.numberCombinedWithUnitRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.NumberCombinedWithUnit);
this.unitRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.UnitRegex);
this.yearAndMonthRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.YearAndMonth);
this.pureNumberYearAndMonthRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.PureNumYearAndMonth);
this.yearToYearRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.YearToYear);
this.YearToYearSuffixRequired = RegExpUtility.getSafeRegExp(ChineseDateTime.YearToYearSuffixRequired);
this.chineseYearRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DatePeriodYearInChineseRegex);
this.seasonWithYearRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.SeasonWithYear);
}
constructor(dmyDateFormat: boolean) {
this.dateRegex = new ChineseDateExtractorConfiguration(dmyDateFormat).dateRegexList;
this.monthOfYear = ChineseDateTime.ParserConfigurationMonthOfYear;
this.dayOfMonth = ChineseDateTime.ParserConfigurationDayOfMonth;
this.dayOfWeek = ChineseDateTime.ParserConfigurationDayOfWeek;
this.specialDayRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.SpecialDayRegex);
this.specialDayWithNumRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.SpecialDayWithNumRegex);
this.thisRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateThisRegex);
this.nextRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateNextRegex);
this.lastRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateLastRegex);
this.unitRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DateUnitRegex);
this.unitMap = ChineseDateTime.ParserConfigurationUnitMap;
this.weekDayRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.WeekDayRegex);
this.integerExtractor = new ChineseIntegerExtractor();
this.numberParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Number, new ChineseNumberParserConfiguration());
}
}
constructor(ci: CultureInfo) {
super(ci);
this.internalNumberExtractor = new ChineseNumberExtractor(ChineseNumberExtractorMode.Default);
this.internalNumberParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Number, new ChineseNumberParserConfiguration());
this.connectorToken = '';
this.currencyNameToIsoCodeMap = ChineseNumericWithUnit.CurrencyNameToIsoCodeMap;
this.currencyFractionCodeList = ChineseNumericWithUnit.FractionalUnitNameToCodeMap;
}
}
this.simpleCasesRegexes = [
RegExpUtility.getSafeRegExp(ChineseDateTime.SimpleCasesRegex),
RegExpUtility.getSafeRegExp(ChineseDateTime.OneWordPeriodRegex),
RegExpUtility.getSafeRegExp(ChineseDateTime.StrictYearRegex),
RegExpUtility.getSafeRegExp(ChineseDateTime.YearToYear),
RegExpUtility.getSafeRegExp(ChineseDateTime.YearToYearSuffixRequired),
RegExpUtility.getSafeRegExp(ChineseDateTime.YearAndMonth),
RegExpUtility.getSafeRegExp(ChineseDateTime.PureNumYearAndMonth),
RegExpUtility.getSafeRegExp(ChineseDateTime.DatePeriodYearInChineseRegex),
RegExpUtility.getSafeRegExp(ChineseDateTime.WeekOfMonthRegex),
RegExpUtility.getSafeRegExp(ChineseDateTime.SeasonWithYear),
RegExpUtility.getSafeRegExp(ChineseDateTime.QuarterRegex),
];
this.datePointExtractor = new ChineseDateExtractor(dmyDateFormat);
this.integerExtractor = new ChineseIntegerExtractor();
this.numberParser = new BaseNumberParser(new ChineseNumberParserConfiguration());
this.illegalYearRegex = RegExpUtility.getSafeRegExp(BaseDateTime.IllegalYearRegex);
this.tillRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.DatePeriodTillRegex);
this.followedUnit = RegExpUtility.getSafeRegExp(ChineseDateTime.FollowedUnit);
this.numberCombinedWithUnit = RegExpUtility.getSafeRegExp(ChineseDateTime.NumberCombinedWithUnit);
this.pastRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.PastRegex);
this.futureRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.FutureRegex);
this.nowRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.NowRegex);
}
constructor() {
let config = new ChineseHolidayParserConfiguration();
super(config);
this.lunarHolidayRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.LunarHolidayRegex);
this.integerExtractor = new ChineseIntegerExtractor();
this.numberParser = AgnosticNumberParserFactory.getParser(AgnosticNumberParserType.Integer, new ChineseNumberParserConfiguration());
this.fixedHolidayDictionary = new Map Date>([
['元旦', ChineseHolidayParser.NewYear],
['元旦节', ChineseHolidayParser.NewYear],
['教师节', ChineseHolidayParser.TeacherDay],
['青年节', ChineseHolidayParser.YouthDay],
['儿童节', ChineseHolidayParser.ChildrenDay],
['妇女节', ChineseHolidayParser.FemaleDay],
['植树节', ChineseHolidayParser.TreePlantDay],
['情人节', ChineseHolidayParser.LoverDay],
['平安夜', ChineseHolidayParser.ChristmasEve],
['圣诞节', ChineseHolidayParser.ChristmasDay],
['新年', ChineseHolidayParser.NewYear],
['愚人节', ChineseHolidayParser.FoolDay],
['五一', ChineseHolidayParser.LaborDay],
['劳动节', ChineseHolidayParser.LaborDay],
['万圣节', ChineseHolidayParser.HalloweenDay],