summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/report.cc10
-rw-r--r--src/report.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc
index 1f8e4743..e1497dac 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -244,6 +244,11 @@ value_t report_t::fn_join(call_scope_t& args)
return string_value(out.str());
}
+value_t report_t::fn_format_date(call_scope_t& args)
+{
+ return string_value(format_date(args[0].to_date(), args[1].to_string()));
+}
+
namespace {
template <class Type = xact_t,
class handler_ptr = xact_handler_ptr,
@@ -567,6 +572,11 @@ expr_t::ptr_op_t report_t::lookup(const string& name)
return MAKE_FUNCTOR(report_t::fn_display_total);
break;
+ case 'f':
+ if (is_eq(p, "format_date"))
+ return MAKE_FUNCTOR(report_t::fn_format_date);
+ break;
+
case 'j':
if (is_eq(p, "join"))
return MAKE_FUNCTOR(report_t::fn_join);
diff --git a/src/report.h b/src/report.h
index df1186ba..fd268c91 100644
--- a/src/report.h
+++ b/src/report.h
@@ -137,6 +137,7 @@ public:
value_t fn_truncate(call_scope_t& scope);
value_t fn_quoted(call_scope_t& scope);
value_t fn_join(call_scope_t& scope);
+ value_t fn_format_date(call_scope_t& scope);
value_t fn_options(call_scope_t& scope) {
return value_t(static_cast<scope_t *>(this));