From baa9ebc17fd766b4b6ebd985f13c5e6612061082 Mon Sep 17 00:00:00 2001 From: antares Date: Sun, 7 Jul 2024 01:31:03 -0700 Subject: [PATCH] made get_epoch_time function --- pleroma-comments.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pleroma-comments.lua b/pleroma-comments.lua index 3a143fb..7de7b11 100644 --- a/pleroma-comments.lua +++ b/pleroma-comments.lua @@ -22,7 +22,7 @@ function get(link) return parsed end -function short_date(timestamp) +function get_epoch_time(timestamp) local pattern = "(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+).000Z" local year, month, day, hour, min, sec = timestamp:match(pattern) local epoch = os.time({ @@ -33,7 +33,13 @@ function short_date(timestamp) min = min, sec = sec }) - return os.date("%a, %B %d, %Y", epoch) + return epoch +end + +function get_short_date(timestamp) + return os.date( + "%a, %B %d, %Y", get_epoch_time(timestamp) + ) end function write_comments(pleroma_posts, instance) @@ -50,7 +56,7 @@ function write_comments(pleroma_posts, instance) local replies = pleroma_posts["descendants"] for _, post in ipairs(replies) do local pid = post["id"] - local datetime = short_date(post["created_at"]) + local datetime = get_short_date(post["created_at"]) local uid = post["account"]["id"] local alias = post["account"]["acct"] local text = post["pleroma"]["content"]["text/plain"] @@ -73,8 +79,8 @@ end function Meta(meta) - local elem = meta["pleroma-url"] --- print(elem) + local elem = meta["pleroma-urls"] + print(elem) if elem == nil then return -- abort end