- Can now convert type_string to type_date via legacy dateformat, provided
  that Context transmits the format.
This commit is contained in:
Paul Beckingham 2014-05-29 00:43:39 -04:00
parent f585f31d69
commit 52eaf3f9c2
4 changed files with 17 additions and 2 deletions

5
NEWS
View file

@ -9,12 +9,13 @@ New Features in taskwarrior 2.4.0
TAGGED.
- The '_get' command properly uses exit codes.
- Regular expressions are now enabled by default.
- The 'filter' verbosity token shows the complete filter used for hte last
- The 'filter' verbosity token shows the complete filter used for the last
command.
New commands in taskwarrior 2.4.0
- New 'calc' utility for quick command line calculations.
- New 'calc' command (and standalone utility) for quick command line
calculations.
New configuration options in taskwarrior 2.4.0

View file

@ -37,6 +37,7 @@
#include <Directory.h>
#include <File.h>
#include <Eval.h>
#include <Variant.h>
#include <text.h>
#include <util.h>
#include <main.h>
@ -639,6 +640,8 @@ void Context::staticInitialization ()
var->substr (0, 12) == "urgency.uda.")
Task::coefficients[*var] = config.getReal (*var);
}
Variant::dateFormat = config.get ("dateformat");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -31,10 +31,13 @@
#include <stdlib.h>
#include <Variant.h>
#include <ISO8601.h>
#include <Date.h>
#include <Duration.h>
#include <RX.h>
#include <text.h>
std::string Variant::dateFormat = "";
////////////////////////////////////////////////////////////////////////////////
Variant::Variant ()
: _type (type_unknown)
@ -1590,6 +1593,12 @@ void Variant::cast (const enum type new_type)
{
_date = (time_t) iso;
}
// Support legacy date formats.
else if (dateFormat != "")
{
Date d (_string, dateFormat);
_date = d.toEpoch ();
}
}
break;
case type_duration:

View file

@ -33,6 +33,8 @@
class Variant
{
public:
static std::string dateFormat;
enum type {type_unknown, type_boolean, type_integer, type_real, type_string,
type_date, type_duration};