Skip to main content Snippets Groups Projects
Commit 441526b5 authored by cleemy desu wayo's avatar cleemy desu wayo
Browse files

Fix bug: show "0 sec ago" if generated at future datetime

parent c8af6b19
Branches main
No related merge requests found
Showing with 5 additions and 3 deletions
#!/usr/bin/env bash
#
# ==========================================================================
# noshow.sh -- version 0.0.99.20230928.3
# noshow.sh -- version 0.0.99.20230929
#
# written by cleemy desu wayo / Licensed under CC0 1.0
#
......@@ -26,7 +26,7 @@ convert_to_ncr() {
| tr -d '\012'
}
software_info='noshow.sh version 0.0.99.20230928.3'
software_info='noshow.sh version 0.0.99.20230929'
# get current time
now_str=$(date "+%Y-%m-%d %H:%M:%S %Z" 2> /dev/null)
......@@ -146,7 +146,9 @@ function overwrite_time_diff() {
const time_diff_day = Math.trunc(time_diff_hour / 24);
let time_diff_str = '';
if (time_diff_day >= 2) {
if (time_diff_sec < 0) {
time_diff_str = '(? sec ago)'; // generated at future datetime
} else if (time_diff_day >= 2) {
time_diff_str = '(' + time_diff_day + ' days ago)';
} else if (time_diff_day === 1) {
time_diff_str = '(1 day ' + (time_diff_hour - 24) + ' hour ago)';
......
  • I wrote a wrong commit message.
    "0 sec ago" instead of "? sec ago" is correct.

  • I wrote a wrong english sentence. I gave DeepL-sensei too much credit. "? sec ago" instead of "0 sec ago" is correct.

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment