nlp(`we met on June 1st 1992 at 8pm, then got married 1998-03-28.`).dates().out('array')
nlp(`it was two weeks after christmas.`).dates().json()[0]
nlp(`see you in three days`).dates().get()[0]
doc=nlp(`i was born September 5th, 1993. March 4th, 2022`).dates().get()[1].start
match={
vardate="";
letm;
constregex=/^\w*-\w*-[0-9]*/gm;
while((m=regex.exec(doc))!==null){
// This is necessary to avoid infinite loops with zero-width matches
if(m.index===regex.lastIndex){
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match,groupIndex)=>{
date=match;
});
}
returndate
}
nlp('four days and seven hours passed').durations().get()[0]
nlp('30mins tuesday').durations().json()[0]
nlp('it was 3 in the morning').times().get()[0]
nlp('meet at 5pm PST').times().get()[0]
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.