diff --git a/database_generation.d b/database_generation.d index dcf7d33..741d289 100644 --- a/database_generation.d +++ b/database_generation.d @@ -65,6 +65,10 @@ struct Timestamp { } } +SysTime parseDbTimestamp(Timestamp s) { + return parseDbTimestamp(s.value); +} + SysTime parseDbTimestamp(string s) { if(s.length == 0) return SysTime.init; auto date = s[0 .. 10]; diff --git a/webtemplate.d b/webtemplate.d index 1b6bd4d..c5d6ee0 100644 --- a/webtemplate.d +++ b/webtemplate.d @@ -49,6 +49,10 @@ Document renderTemplate(string templateName, var context = var.emptyObject, var return month ~ "/" ~ day ~ "/" ~ year; }; + context.dayOfWeek = function string(string s) { + return daysOfWeekFullNames[DateTime.fromISOExtString(s).dayOfWeek]; + }; + context.formatTime = function string(string s) { if(s.length < 20) return s; @@ -241,6 +245,16 @@ void populateForm(Form form, var obj, string name) { } +immutable daysOfWeekFullNames = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" +]; + /+ mixin template WebTemplatePresenterSupport() {