chris-website/source/utils.d

17 lines
310 B
D
Raw Normal View History

2020-06-24 08:08:28 +00:00
import std.conv;
import std.datetime;
import dyaml;
string toHumanString(DateTime value) {
return to!string(value.year) ~ "-" ~ to!string(ubyte(value.month)) ~ "-" ~ to!string(value.day);
}
T getOr(T)(Node node, string key, T or) {
if (key in node) {
return node[key].get!T;
} else {
return or;
}
}