bug fix: recognize all-day events, improvment: view source with v

This commit is contained in:
2025-06-13 22:39:23 +02:00
parent e09c38ee29
commit 16193b5554
3 changed files with 37 additions and 17 deletions

View File

@@ -49,17 +49,23 @@ END {
# If nanoseconds are not 0, then we assume user enterd "tomorrow" or
# something the like, and we make this a date entry, as opposed to a
# date-time entry.
# Similalry, if the time is 00:00, we make this a date, as opposed to a
# date-time entry.
gsub("\"", "\\\"", from)
cmd = "date -d \"" from "\" +\"%N\"";
cmd | getline n
close(cmd)
n = n + 0
cmd = "date -d \"" from "\" +\"%H%M\"";
cmd | getline t
close(cmd)
t = t + 0
if (t == 0) {
from_type = "DATE-TIME"
cmd = "date -d \"" from "\" +\"@%s\" | xargs date -u +\"%Y%m%dT%H%M00Z\" -d"
} else {
if (n != 0 || t == 0) {
from_type = "DATE"
cmd = "date -d \"" from "\" +\"%Y%m%d\"";
} else {
from_type = "DATE-TIME"
cmd = "date -d \"" from "\" +\"@%s\" | xargs date -u +\"%Y%m%dT%H%M00Z\" -d"
}
suc = cmd | getline from
close(cmd)
@@ -69,15 +75,19 @@ END {
#
gsub("\"", "\\\"", to)
cmd = "date -d \"" to "\" +\"%N\"";
cmd | getline n
close(cmd)
n = n + 0
cmd = "date -d \"" to "\" +\"%H%M\"";
cmd | getline t
close(cmd)
t = t + 0
if (t == 0) {
to_type = "DATE-TIME"
cmd = "date -d \"" to "\" +\"@%s\" | xargs date -u +\"%Y%m%dT%H%M00Z\" -d"
} else {
if (n != 0 || t == 0) {
to_type = "DATE"
cmd = "date -d \"" to "\" +\"%Y%m%d\"";
} else {
to_type = "DATE-TIME"
cmd = "date -d \"" to "\" +\"@%s\" | xargs date -u +\"%Y%m%dT%H%M00Z\" -d"
}
suc = cmd | getline to
close(cmd)