r8 - 12 Jul 2007 - 10:43:10 - MimiYinYou are here: OSAF >  Journal Web  >  MimiYinNotes > DateTimeParsing

Parsing dates and times

Use Cases - Are we doing things like...

  • in 3 hours/weeks/months/years
  • in the next hour/week/month/year
  • at a quarter of 4
  • end of next week
  • end of Tuesday

--DarshanaC: "at a quarter of 4","end of Tuesday" are not handled. Words like "half", "quarter" or number names are not handled

Prepositions

  • in
  • on
  • of
  • at

Modifier

  • previous
  • prev
  • last
  • next
  • next next?? --DarshanaC : not handled
  • this
  • eo
  • end of ?? --bear: yes
  • end\sof ??
  • in/sa ??
    --bear: currently "in a" is handled; --Main.MimiYin e.g. in a week? in 3 weeks?
    --bear: they should be handled - I'll check the unit tests

Modifider 2

  • from
  • before
  • after
  • ago
  • prior

How about??

  • all, e.g. all morning
  • late, e.g. late evening
  • early, e.g. early afternoon
  • top of the
  • in the middle of
  • just before
  • just after
  • a quarter of
  • a quarter past
  • half past

--bear: a lot of these have words that should probably be ignored by the parser, like "just" "all" "a"

HH:MM:SS AM/PM Can we accommodate the following?

  • HH:MM AM/PM
  • HH:MM
  • H:MM
  • HAM/PM

  • DD/MM/YY
  • DD/MM/YYYY

--bear: the time formats listed above should already be handled

Abbreviations for Months and Days of the Week?

Months

  • January Jan
  • February Feb
  • March Mar
  • April Apr
  • May
  • June Jun
  • July Jul
  • August Aug
  • September Sep
  • October Oct
  • November Nov
  • December Dec

Days of the Week

  • Monday Mon
  • Tuesday Tue
  • Wednesday Wed
  • Thursday Thu
  • Friday Fri
  • Saturday Sat
  • Sunday Sun

--bear: I added the short forms to the list above

Relative Days

  • Today
  • Tomorrow
  • Yesterday

Time of Day

  • Breakfast
  • Lunch
  • Dinner
  • Morning
  • Noon
  • Evening
  • Tonight
  • Night
  • Now
  • Midnight

How about??

  • Afternoon
  • Brunch
  • Dawn
  • Dusk
  • Twilight

--bear: easily added, just need to know what time of day to associate them with
--Main.MimiYin Well, it'd be cool if it was dynamic (real dawn and dusk, etc) Let's just do Afternoon and Brunch for now.

    • Afternoon: 2PM
    • Early afternoon: 1PM
    • Late afternoon: 4PM
    • Brunch: 11AM

    • Early evening: 5PM
    • Late evening: 8PM

--bear: we can make them dynamic if you mean that the time changes based on the quarter or some other date range. It's also possible for these to be overridden by Chandler, they are stored in a dictionary that is accessible to the calling program.

Current unit test examples

The following is the text from TestUnits, TestSimpleOffsets, TestSimpleDateTimes and TestMultiple -- these are tested using assertTrue()

--bear:

5 minutes from now
5 min from now
5m from now
in 5 minutes
in 5 min
5 min from now
5 minutes
5 min
5m
5 minutes before now
5 min before now
5m before now
5 hours from noon
5 hours after noon
5 hours after 12pm
5 hours after 12 pm
5 hours after 12:00pm
5 hours after 12:00 pm
5 hours before noon
5 hours before 12pm
5 hours before 12 pm
5 hours before 12:00pm
5 hours before 12:00 pm
in 1 week
1 week from now
in 7 days
7 days from now
next week
1 week before now
7 days before now
last week
tomorrow
next day
yesterday
today
1 minute
1 minutes
1 min
1min
1 m
1m
1 hour
1 hours
1 hr
1 day
1 days
1days
1 dy
1 d
-1 day
-1 days
-1days
-1 dy
-1 d
- 1 day
- 1 days
- 1days
- 1 dy
- 1 d
1 week
1week
1 weeks
1 wk
1 w
1w
1 month
1 months
1month
1 year
1 years
1 yr
1 y
1y
11:00:00 PM
11:00 PM
11 PM
11PM
2300
23:00
11p
11pm
11:00:00 AM
11:00 AM
11 AM
11AM
1100
11:00
11a
11am
730
0730
1730
173000
08/25/2006
08.25.2006
8/25/6
8/25
8.25
08/25
morning
breakfast
lunch
evening
dinner
night
tonight
midnight
12:00:00 AM
12:00 AM
12 AM
12AM
12am
12a
0000
00:00
noon
12:00:00 PM
12:00 PM
12 PM
12PM
12pm
12p
1200
12:00
3 years 2 weeks 5 days
3years 2weeks 5days
3 y 2 w 5 d
3y 2w 5d
3y 5h 50m
3 years, 2 weeks, 5 days
3 years, 2 weeks and 5 days
3y, 2w, 5d 
4pm + 3 days
4pm +3 days
4pm - 3 days
4pm -3 days

Localizing DateTime? Parsing

... To be filled in

-- MimiYin - 28 Aug 2006

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r8 < r7 < r6 < r5 < r4 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.