First push

This commit is contained in:
nkaputnik
2022-07-26 09:47:56 +02:00
parent 9617e576f0
commit 9c2a7598f2
16 changed files with 414 additions and 10438 deletions

View File

@@ -1,5 +1,28 @@
function getYear(v) {
return parseInt(v.substr(0, 4))
}
function getMonth(v) {
return parseInt(v.substr(5, 2))
}
function getDay(v) {
return parseInt(v.substr(8, 2))
}
function getAge(from, to) {
if (from === undefined || from == null) return 0
if (to === undefined || to == null) to = new Date().toISOString()
let year = getYear(to) - getYear(from) - 1
if (
getMonth(to) > getMonth(from) ||
(getMonth(to) === getMonth(from) && getDay(to) >= getDay(from))
) {
year++
}
return year
}
const result_ = Array.isArray(result) ? result : [result]
for (const row of result_) {
row.modifiedBy += " --- read in sandbox"
row.age = 27
row.age = getAge(row.dateOfBirth, row.dateOfDeath)
}