aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlibexec/recit-add-entry15
1 files changed, 8 insertions, 7 deletions
diff --git a/libexec/recit-add-entry b/libexec/recit-add-entry
index dba9ef5..078000e 100755
--- a/libexec/recit-add-entry
+++ b/libexec/recit-add-entry
@@ -38,6 +38,14 @@ if [[ "$query_time" = "" ]]; then
query_time="now"
fi
+if [[ "$query_time" == "now" || "$query_time" == "today" ]]; then
+ fmt_date=$(date '+%Y-%m-%d %r')
+elif [[ "$query_time" == "tomorrow" ]]; then
+ fmt_date=$(perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d', localtime(time + 86400)), qq(\n);")
+else
+ fmt_date=$query_time
+fi
+
if [[ "$notes" = "" ]]; then
if [[ -z ${EDITOR+x} ]]; then
@@ -51,13 +59,6 @@ if [[ "$notes" = "" ]]; then
rm "$tmpfile"
fi
-if [[ "$query_time" == "now" || "$query_time" == "today" ]]; then
- fmt_date=$(date '+%Y-%m-%d %r')
-elif [[ "$query_time" == "tomorrow" ]]; then
- fmt_date=$(perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d', localtime(time + 86400)), qq(\n);")
-else
- fmt_date=$query_time
-fi
if [[ "$project" = "" ]]; then
recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -t Entry "${recfile}"