Last change for defaulting values for created/modified integer date

This commit is contained in:
Ryan Coyne 2017-11-26 19:05:24 -05:00
parent 93d6e57dbd
commit 7d8994b138
1 changed files with 8 additions and 1 deletions

View File

@ -89,7 +89,14 @@ extension Array where Iterator.Element == Mirror {
// Make sure our child has a label & the string describing the value is not nil. (Making optionals supported)
if !includingNilValues {
if child.label.isNotNil, String(describing: child.value) != "nil" {
allChild.append(child)
// If we default a created/modified integer to zero we need to overwrite it here:
if child.label! == "created" || child.label! == "modified" {
var mutableChild = child
mutableChild.value = Int(Date().timeIntervalSince1970)
allChild.append(mutableChild)
} else {
allChild.append(child)
}
// Automatic created & modified fields:
} else if child.label.isNotNil, child.label == "created" || child.label == "modified" {
var mutableChild = child