change to written_at

This commit is contained in:
slonkazoid 2024-12-29 23:12:27 +03:00
parent b37fdc634c
commit c00aba77eb
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

8
blag
View file

@ -29,17 +29,17 @@ metadata() {
local icon=$(_json_str_opt "$ICON")
local icon_alt=$(_json_str_opt "$ICON_ALT")
local color=$(_json_str_opt "$COLOR")
local created_at=$(_json_str_opt "$CREATED_AT")
local written_at=$(_json_str_opt "$WRITTEN_AT")
local modified_at=$(_json_str_opt "$MODIFIED_AT")
local tags=$(for tag in "${TAGS[@]}"; do printf '%s' "$tag" | jq -Rs .; done | jq -sr @json)
local dont_cache=false
[[ "${DONT_CACHE:+x}" == 'x' ]] && dont_cache=true
local raw=$(_json_str_opt "$RAW")
printf '{"title":%s,"description":%s,"author":%s,"icon":%s,"icon_alt":%s,"color":%s,"created_at":%s,"modified_at":%s,"tags":%s,"dont_cache":%s,"raw":%s}\n' \
printf '{"title":%s,"description":%s,"author":%s,"icon":%s,"icon_alt":%s,"color":%s,"written_at":%s,"modified_at":%s,"tags":%s,"dont_cache":%s,"raw":%s}\n' \
"$title" "$description" "$author" \
"$icon" "$icon_alt" "$color" \
"$created_at" "$modified_at" \
"$written_at" "$modified_at" \
"$tags" "$dont_cache" "$raw"
}
@ -93,7 +93,7 @@ render() {(
if (( ! DATES_CALCULATED )); then
birth=$(stat -c'%W' "$path")
if (( birth > 0 )); then
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
WRITTEN_AT=$(date --rfc-3339=seconds -d "@$birth")
fi
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$path")")
DATES_CALCULATED=1