This should be divided into 2 libraries:
npm install epoch
TODO browser version.
Period objects. Periods can have start and/or end times, and/or durations. Time is fuzzy. There is also the
The api should look something like this:
var epoch = ;assert;epoch;epoch;
Internals of the API
var epoch =Period = epochPeriodInterval = epochIntervalInstant = epochInstant;// If you add this period to the 1st February (ISO) then you will get the 1st March.// If you add the same period to the 1st March you will get the 1st April.// But the duration added (in milliseconds) in these two cases is very different.var period = months: 1;var instant = Instant;instant;instant; // "Mar 1, 2012"// more complicated// this says the winter solstice is on Dec 21, 2012,// sometime between 6:00pm and 11:59pm (just made those numbers up)var winterSolstice ='Dec 21, 2012 at 6:00pm'hours: 6 // better name is "Duration";// then you could go to next years winter solstice:winterSolstice// and it should be Dec 21, 2013 from 6pm - 11:59pm
Then some BC calculations:
var originOfAgriculture = epoch;// which you could manually set up like this (but would have to know the internals of how BCE is handled)var originOfAgriculture = ;originOfAgriculture;// there should be better ways to do this.http://mail-archives.apache.org/mod_mbox/xml-xalan-dev/201204.mbox/%3C4F8B913C.email@example.com%3E
// 1 million years agovar mya = years: -1000000;var mya = years: -1000000;// periods can have start and end dates, or they don't have to.var triassicPeriod = years: -250 * 1000000 years: -200 * 1000000;triassicPeriodstartTime;var triassicPeriod = -250 -200 'mya';var triassicPeriod = -250 'ma' 200 'ma';// maybe "unit" specifies the default operator or somethingvar triassicPeriod = -250 'mya' -200 'mya';triassicPeriodstartTimevar extinction = 65 'mya';// how many years after the triassic period?var periodBetween = triassicPeriodendTime extinction;var millionYearsAfter = periodBetween; // 200 - 65 = 135 mavar yearsAfter = periodBetween; // 200 - 65 = 135 ma
This should print the date in a standard format that can be saved to a database. Some ideas are: (TODO)
John left by the time he leftJohn left by the time he ateJohn ate by the time he leftJohn left by the time he ateApril is usually wet. genericI was born on a Tuesday. indefiniteI had swimming classes on every Tuesday in 1999. gapped intervalWinter 1999 was extremely severe. vagueWe got married about three years ago. approximateThe first three days of every month are always the busiest. set of intervalsThe movie is two hours long. unanchored intervalShe left five days after he came back. event-dependantCategory ExamplesAdverbs simultaneously, currently, lately, today, yesterday, tomorrowFrequencyAdverbsa lot, always, ever, frequently, hardly ever, never, normally, occasionally,often, frequently, rarely, sometimes, usually, hourly, daily, weekly ormonthlyPrepositionalPhraseon Monday, at 5 o'clock, for one hour, in January, over many years,during the weekend, after the meeting, before 8pm, between 11am and1pm, by Monday morning, since 1978, until January 2006, from 1939 to1945, within one hour, following the meetingPostpositionalPhrasefive months ago, five months hence, five months on, the whole nightthroughOther Adverbial Phrases: later than ever before, at least five years, all spring, on Tuesday at noonAdverbial Clause: when she saw the snake, as soon as I have any newsNoun Phrase coming weeks, a beautiful morning, cold wintersJohn visited his parents twice in two years.John learnt Japanese for half an hour every morning for a month.John washed cars from morning till night from June till August.John had arrived on Tuesday at noon.On Tuesday, John had arrived at noon.Last week, John had arrived 3 days ago.John had arrived at noon on Tuesday.John had arrived 3 days ago last week.Category Lexical Triggers Non-TriggersNoun minute, afternoon, midnight, day,night, weekend, month, summer,season, quarter, year, decade, cen-tury, millennium, era, semester, fu-ture, past, time, period, pointinstant, jiy, episode, occasion,tenure, timetable, reign, light year,megawatt hour, lifetime, historyAdjective recent, former, current, future, past,daily, monthly, biannual, semian-nual, daytime, daylong, onetime,ago, preseason, short-term, long-termearly, ahead, next, subsequent, fre-quent, perpetual, later, contempo-rary, simultaneous, preceding, pre-vious, existing, modernAdverb currently, lately, hourly, daily,monthly, ago (+ adverbial forms ofadjective triggers)earlier, immediately, instantly,forthwith, meanwhile, heretofore,previously, next, beforehand, fol-lowing, later, soon, sooner, shortly,eventually, occasionally, once, still,again, timely, wheneverTimenoun/adverbnow, today, yesterday, tomorrowNumber 3, three, third, sixtiesProper name Monday, January, New Year's Eve,Washing's Birthday, SolsticePronouns that, then, it (only pronouns thatco-refer with a markable expression)Time patterns 8:00, 12/02/2000, 1994, 1960sthat cold day the next day late last nightearlier that year next summer recent decadesnumerous Saturdays more than a month no less than 60 daysjust a year ago only one hour long its own futurethe countrys future just a year ago only one hour longfive years old a few weeks later hours earlierfive days after he came back three decades ago the second-best quarter evermonths of renewed hostility a historic day for the European enterprisenearly four decades of experiencePerhaps in the next two weeks.How 'bout the afternoon of Monday the ninth?Okay, how 'bout Tuesday March the sixteenth sometime after twelve o'clock pm?9th Sep. 1987an hour and 30 minutesTuesday and ThursdayWednesday or Friday4 o'clocknext monthexactly one minute agothe 2nd Sunday in MayWednesday from 3pm to 5pmin the past 3 yearsevery 2 minutes and 30 secondsfrom 3pm to 5pmthe rest of the yearsometime between 3pm and 5pmother than Wednesdayless than 1 hour and 30 minutessometime before Sept. 9, 1987sometime in 1987January to March and May 20078am, except Mondays 9 amthe following monththe second Tuesday after Eastertwo consecutive Sundaystodaythree Mondaysall Mondays in every Mayall Mondays in any Mayany Monday in every Maythe courses when the student has free timeWe met in July last yearOn Monday and Tuesdaythree months earlierfrom 3pm to 6pmThey are leaving on vacation two weeks from next Tuesday.A major earthquake struck Los Angeles three years ago today.This year’s summer was unusually hot.Bacon tutored an English student some Thursdays in 1998.She spent the following twelve years in various health care positions around Minnesota.Ash WednesdayEaster SundayChristmas DayAdnan Pachachi, a onetime foreign minister who returned to Iraq on May 6 after 33 years in exile...Yeah. I'm leaving on Monday and coming back on the thirtieth, so um
Things that seem like they could trip up the parser (randomly jotted down):
- I am exercising my state and federal constitutional rights including the 1st, 4th and 5th amendments.