From 78dcfd44aa7986127835e76331e53ef148b24687 Mon Sep 17 00:00:00 2001 From: Konstantin Nazarov Date: Sat, 25 Sep 2021 16:58:42 +0100 Subject: [PATCH] Make rss generation cross-platform --- bin/rss.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/rss.sh b/bin/rss.sh index ead0b66..e7c9dc1 100755 --- a/bin/rss.sh +++ b/bin/rss.sh @@ -5,11 +5,19 @@ remove_nbsp() { } date_rfc_822() { - date -j '+%a, %d %b %Y %H:%M:%S %z' + if [[ "$OSTYPE" == "darwin"* ]]; then + date -j '+%a, %d %b %Y %H:%M:%S %z' + else + date '+%a, %d %b %Y %H:%M:%S %z' + fi } date_to_rfc_822() { - date -f "%Y-%m-%dT%H:%M:%SZ" -j '+%a, %d %b %Y %H:%M:%S %z' "$1T00:00:00Z" + if [[ "$OSTYPE" == "darwin"* ]]; then + date -f "%Y-%m-%dT%H:%M:%SZ" -j '+%a, %d %b %Y %H:%M:%S %z' "$1T00:00:00Z" + else + date '+%a, %d %b %Y %H:%M:%S %z' -d "$1T00:00:00Z" + fi } get_header() {