diff --git a/sdk/plugins/format.cpp b/sdk/plugins/format.cpp index daf901b..9e1e7b2 100644 --- a/sdk/plugins/format.cpp +++ b/sdk/plugins/format.cpp @@ -14,6 +14,7 @@ * limitations under the License. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #ifndef BR_EMBEDDED #include #include @@ -179,6 +180,15 @@ class xmlFormat : public Format subject = subject.nextSibling(); } + // Calculate age + if (t.file.contains("DOB")) { + const QDate dob = QDate::fromString(t.file.getString("DOB").left(10), "yyyy-MM-dd"); + const QDate current = QDate::currentDate(); + int age = current.year() - dob.year(); + if (current.month() < dob.month()) age--; + t.file.insert("Age", age); + } + return t; } };