- 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

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: