if [ "$((${end_time%:*} * 60 + ${end_time#*:}))" -gt "$((${start_time%:*} * 60 + ${start_time#*:}))" ]; then
end_date="$start_date"
else
- end_date="$(date -d "@$(($(date -d "$start_date" +%s) + 86400))" +%F)"
+ end_date="$(date -ud "@$(($(date -ud "$start_date" +%s) + 86400))" +%F)"
fi
fi
rec_int="year";;
esac
-[ "$rec_end" ] && rec_end="$(date -d "$rec_end" +%s)" \
+[ "$rec_end" ] && rec_end="$(date -ud "$rec_end" +%s)" \
if LOCK './#events'; then
sed -i "/^${_DATE} /!d" './#events'
evid="$(wc -l <'./#events' || printf 0)"
printf '%i %i %i %i %s %i %s %s\n' \
- "$_DATE" "$(date -d "$start_date $start_time" +%s)" "$(date -d "$end_date $end_time" +%s)" \
+ "$_DATE" "$(date -ud "$start_date $start_time" +%s)" "$(date -ud "$end_date $end_time" +%s)" \
"${rec_freq:-0}" "${rec_int:-\\}" "${rec_end:--1}" "$(STRING "${title}")" "$(STRING "${PATH_INFO}#event${evid}")" \
>>'./#events'
RELEASE './#events'
fi
-start="$(date -d "$start_date $start_time" +%s)"
- end="$(date -d "$end_date $end_time" +%s)"
+start="$(date -ud "$start_date $start_time" +%s)"
+ end="$(date -ud "$end_date $end_time" +%s)"
if [ $_DATE -le $end ]; then
nstart="$start" nend="$end"
;;
month)
{ read _y _m _d; read y m d; } <<-EOF
- $(date -d @$_DATE +"%Y %_m %_d"
- date -d @$start +"%Y %_m %_d"
+ $(date -ud @$_DATE +"%Y %_m %_d"
+ date -ud @$start +"%Y %_m %_d"
)
EOF
_m=$((_y * 12 + _m)) m=$((y * 12 + m))
m=$(( rec_freq - ((_m - m - 1) % rec_freq + 1) + _m ))
# y=$(((m - 1) / 12)) m=$(((m - 1) % 12 + 1)); # [ $m -eq 0 ] && y=$((y - 1)) m=12;
nstart="$(printf '%04i-%02i-%02i' "$(( (m - 1) / 12 ))" "$(( (m - 1) % 12 + 1 ))" "$d")"
- if isdate "$nstart" && [ "$(date -d "$nstart" +%s)" -ge "$_DATE" ]; then
+ if isdate "$nstart" && [ "$(date -ud "$nstart" +%s)" -ge "$_DATE" ]; then
break
fi >/dev/null
# m=$((y * 12 + m))
_m="$((_m + rec_freq))"
done
- nstart="$(date -d "$nstart $start_time" +%s)"
+ nstart="$(date -ud "$nstart $start_time" +%s)"
nend="$((end - start + nstart))"
;;
year)
{ read _y _m _d; read y m d; } <<-EOF
- $(date -d @$_DATE +"%Y %_m %_d"
- date -d @$start +"%Y %_m %_d"
+ $(date -ud @$_DATE +"%Y %_m %_d"
+ date -ud @$start +"%Y %_m %_d"
)
EOF
while :; do
# mod=$(( ( _y - y ) % rec_freq )); [ $mod -eq 0 ] && mod="$rec_freq"
y=$(( rec_freq - ((_y - y - 1) % rec_freq + 1) + _y ))
nstart="$(printf '%04i-%02i-%02i' "$y" "$m" "$d")"
- if isdate "$nstart" && [ $(date -d "$nstart" +%s) -ge $_DATE ]; then
+ if isdate "$nstart" && [ $(date -ud "$nstart" +%s) -ge $_DATE ]; then
break
fi >/dev/null
_y="$((_y + rec_freq))"
done
- nstart="$(date -d "$nstart $start_time" +%s)"
+ nstart="$(date -ud "$nstart $start_time" +%s)"
nend="$((end - start + nstart))"
;;
'')
[div .macro .event #event${evid}
[label . $(HTML "$title")]
[dl
- [dt $(_ Start:)][dd $(date -d @$nstart +"%F %T")]
- [dt $(_ End:)][dd $(date -d @$nend +"%F %T")]
- [dt $(_ Until:)][dd $(date -d @$rec_end +"%F %T")]
+ [dt $(_ Start:)][dd $(date -ud @$nstart +"%F %T")]
+ [dt $(_ End:)][dd $(date -ud @$nend +"%F %T")]
+ [dt $(_ Until:)][dd $(date -ud @$rec_end +"%F %T")]
]
]
EOF
# PRODID:ShellWiki Event Macro
# BEGIN:VEVENT
# UID:$uid@$(HEADER Host)
-# DTSTAMP:TZID=${tzid}:$(date +%Y%m%dT%H%M%S)
-# DTSTART:TZID=${tzid}:$(date +%Y%m%dT%H%M%S -d "$start_date $start_time")
+# DTSTAMP:TZID=${tzid}:$(date -u +%Y%m%dT%H%M%S)
+# DTSTART:TZID=${tzid}:$(date -u +%Y%m%dT%H%M%S -d "$start_date $start_time")
# DURATION:
-# RRULE:FREQ=$ec_freq;INTERVAL=$rec_int;UNTIL=$(date +%Y%m%dT000000Z -d "$rec_end")
+# RRULE:FREQ=$ec_freq;INTERVAL=$rec_int;UNTIL=$(date -u +%Y%m%dT000000Z -d "$rec_end")
# SUMMARY:
# COMMENT:
# END:VEVENT