- MFH: Support for "back of <hour>" and "front of <hour>" phrases that are used

in Scotland.
This commit is contained in:
Derick Rethans 2008-08-29 12:01:57 +00:00
parent 4b5dd8e396
commit e3cd394979
3 changed files with 15018 additions and 14449 deletions

2
NEWS
View File

@ -290,6 +290,8 @@ PHP NEWS
around the current day.
. support for "<xth> <weekday of" and "last <weekday> of" phrases to be used
with months - like in "last saturday of februari 2008".
. support for "back of <hour>" and "front of <hour>" phrases that are used in
Scotland.
. DatePeriod class which supports iterating over a DateTime object applying
DateInterval on each iteration, up to an end date or limited by maximum
number of occurences.

File diff suppressed because it is too large Load Diff

View File

@ -931,6 +931,8 @@ isoweek = year4 "-"? "W" weekofyear;
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
firstdayof = 'first day' ' of'?;
lastdayof = 'last day' ' of'?;
backof = 'back of ' hour24 space? meridian?;
frontof = 'front of ' hour24 space? meridian?;
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
@ -1060,6 +1062,29 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
return TIMELIB_LF_DAY_OF_MONTH;
}
backof | frontof
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
TIMELIB_UNHAVE_TIME();
TIMELIB_HAVE_TIME();
if (*ptr == 'b') {
s->time->h = timelib_get_nr((char **) &ptr, 2);
s->time->i = 15;
} else {
s->time->h = timelib_get_nr((char **) &ptr, 2) - 1;
s->time->i = 45;
}
if (*ptr != '\0' ) {
timelib_eat_spaces((char **) &ptr);
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
}
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
weekdayof
{
timelib_sll i;