diff options
-rw-r--r-- | src/times.cc | 11 | ||||
-rw-r--r-- | test/regress/375.test | 36 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/times.cc b/src/times.cc index 3fd9a1df..b527de87 100644 --- a/src/times.cc +++ b/src/times.cc @@ -839,6 +839,17 @@ void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok, specifier.month = date_specifier_t::month_type (boost::get<date_time::months_of_year>(*tok.value)); + tok = lexer.next_token(); + switch (tok.kind) { + case lexer_t::token_t::TOK_A_YEAR: + specifier.year = boost::get<date_specifier_t::year_type>(*tok.value); + break; + case lexer_t::token_t::END_REACHED: + break; + default: + tok.unexpected(); + break; + } break; case lexer_t::token_t::TOK_A_WDAY: specifier.wday = diff --git a/test/regress/375.test b/test/regress/375.test new file mode 100644 index 00000000..84254155 --- /dev/null +++ b/test/regress/375.test @@ -0,0 +1,36 @@ + +2009-01-01 * Jan 09 + Assets:Current 100.00 EUR + Income:Salary + +2009-02-01 * Feb 09 + Assets:Current 100.00 EUR + Income:Salary + +2009-03-01 * Mar 09 + Assets:Current 100.00 EUR + Income:Salary + +2010-01-01 * Jan 10 + Assets:Current 100.00 EUR + Income:Salary + +2010-02-01 * Feb 10 + Assets:Current 100.00 EUR + Income:Salary + +test reg -p "until Feb 2009" +09-Jan-01 Jan 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + +test reg -p "until February 2009" +09-Jan-01 Jan 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + +test reg -p "in Feb 2009" +09-Feb-01 Feb 09 Assets:Current 100.00 EUR 100.00 EUR + Income:Salary -100.00 EUR 0 +end test + |