mirror of https://github.com/adamdruppe/arsd.git
new convenience func
This commit is contained in:
parent
1268d3bf42
commit
ed20829686
|
@ -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];
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue