mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
DOM: Durations may now be ISO8601p or Duration
This commit is contained in:
parent
6aaa7c5074
commit
3a9505f56c
1 changed files with 14 additions and 1 deletions
13
src/DOM.cpp
13
src/DOM.cpp
|
@ -32,6 +32,7 @@
|
|||
#include <Duration.h>
|
||||
#include <Context.h>
|
||||
#include <Nibbler.h>
|
||||
#include <ISO8601.h>
|
||||
#include <Date.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
|
@ -318,7 +319,19 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
|||
if (column->type () == "date")
|
||||
value = Variant (ref.get_date (canonical), Variant::type_date);
|
||||
else if (column->type () == "duration")
|
||||
{
|
||||
std::string period = ref.get (canonical);
|
||||
context.debug ("ref.get(" + canonical + ") --> " + period);
|
||||
|
||||
ISO8601p iso;
|
||||
std::string::size_type cursor = 0;
|
||||
if (iso.parse (period, cursor))
|
||||
value = Variant ((time_t) iso._value, Variant::type_duration);
|
||||
else
|
||||
value = Variant ((time_t) Duration (ref.get (canonical)), Variant::type_duration);
|
||||
|
||||
context.debug ("value --> " + (std::string) value);
|
||||
}
|
||||
else if (column->type () == "numeric")
|
||||
value = Variant (ref.get_float (canonical));
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue