expiry time to 12 hour format?
l4n1skyy opened this issue · comments
Hey! First, let me politely say that you should write an issue differently.
First of all, you should make sure that you use correct capitalization and punctuation marks.
Second, you should formulate a precise question, not just one sentence which states what happened.
Third, you should actually think about the problem and try to solve it for yourself. At the very least you must identify which software exactly causes the problem.
In your case, for example, it's pretty clear, either directly from the problem or from just executing
$ dunstify -u low -r -12345 "Timer expires at $( date -d "2000 sec" +%h:%M %a)"
date: extra operand ‘%a’
Try 'date --help' for more information.
, that this is not a problem of my script, but it's about passing wrong arguments to the command date
.
For confirmation, you then could have executed:
$ date -d "2000 sec" +%h:%M %a
date: extra operand ‘%a’
Try 'date --help' for more information.
So this issue board here isn't even the right place for the problem. If you can't resolve such an argument problem for some time, you should rather ask on some Linux Forum.
Anyways, from the error message and the arguments it's already pretty clear that the problem is that %a
is treated as another argument (and not together with +%h:%M
). So you can just solve it by putting quotes around it:
$ date -d "2000 sec" "+%h:%M %a"
Aug:50 Mon
Going back to the command, you can hence fix it to:
printExpiryTime () { dunstify -u low -r -12345 "Timer expires at $( date -d "$(secondsLeft) sec" "+%h:%M %a")" ;}
My bad! I'm really sorry for not following the guidelines for writing an issue. I definitely should have tried out more things before writing the issue. Thank you for pointing out the mistake I made and writing the solution, I really appreciate it!