Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
resultWithDate.start.imply('hour', resultWithTime.start.get('hour'));
resultWithDate.start.imply('minute', resultWithTime.start.get('minute'));
resultWithDate.start.imply('meridiem', resultWithTime.start.get('meridiem'));
resultWithDate.start.imply('timezoneOffset', resultWithTime.start.get('timezoneOffset'));
resultWithTime.start.imply('weekday', resultWithDate.start.get('weekday'));
resultWithTime.start.imply('day', resultWithDate.start.get('day'));
resultWithTime.start.imply('month', resultWithDate.start.get('month'));
resultWithTime.start.imply('year', resultWithDate.start.get('year'));
return results;
};
const hrsMinsParser = new chrono.Parser();
hrsMinsParser.pattern = () => /(\d+)\s*hrs?(\s+(\d+)\s*min(s|ute|utes)?)?/i; // Match a pattern like "in 22hrs (30 mins)"
hrsMinsParser.extract = (text, ref, match, opt) => {
let dateMoment = require('moment')(ref);
dateMoment = dateMoment.add(match[1], 'hours');
dateMoment = dateMoment.add(match[3], 'minutes');
return new chrono.ParsedResult({
ref: ref,
text: match[0],
index: match.index,
start: {
hour: dateMoment.hour(),
minute: dateMoment.minute(),
second: dateMoment.second(),
day: dateMoment.date(),
month: dateMoment.month() + 1,
year: dateMoment.year(),