summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2014-02-12 10:38:07 +0100
committerAlexis Hildebrandt <afh@surryhill.net>2014-02-12 10:38:07 +0100
commite7cfaa1e652ac989ac33bda824b53dee401c10b3 (patch)
tree022bb36faa7c03db0b47d3969418e1f0f4f99ff2 /src/textual.cc
parentc59aadaace0b142eacb89d40921ac331887bb671 (diff)
downloadfork-ledger-e7cfaa1e652ac989ac33bda824b53dee401c10b3.tar.gz
fork-ledger-e7cfaa1e652ac989ac33bda824b53dee401c10b3.tar.bz2
fork-ledger-e7cfaa1e652ac989ac33bda824b53dee401c10b3.zip
Fix apply_year_directive
Using the Y 2014 syntax works fine, but using apply year 2014 resulted in the following error: Error: Year is out of valid range: 1400..10000 since part of the given year string was chopped off.
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 5536359d..d8648c93 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -416,7 +416,7 @@ void instance_t::read_next_directive(bool& error_flag)
price_xact_directive(line);
break;
case 'Y': // set the current year
- apply_year_directive(line);
+ apply_year_directive(line + 1);
break;
}
}
@@ -865,7 +865,7 @@ void instance_t::apply_year_directive(char * line)
// This must be set to the last day of the year, otherwise partial
// dates like "11/01" will refer to last year's november, not the
// current year.
- unsigned short year(lexical_cast<unsigned short>(skip_ws(line + 1)));
+ unsigned short year(lexical_cast<unsigned short>(skip_ws(line)));
DEBUG("times.epoch", "Setting current year to " << year);
epoch = datetime_t(date_t(year, 12, 31));
}