Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions diaryman.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ if [[ -n "$1" ]]; then

# Allowing retroactive diary entries with $ diary Y-m-d
# Validate date format
date -jf %Y-%m-%d $1 > /dev/null 2>&1;
date -d "$1" > /dev/null 2>&1;
if [ "$?" -ne "0" ]; then
echo "Date is not formatted correctly";
exit 1;
fi
year=$(date -jf %Y-%m-%d "$1" +%Y);
month=$(date -jf %Y-%m-%d "$1" +%m);
year=$(date -d "$1" +%Y);
month=$(date -d "$1" +%m);
datename=$1;
weekday=$(date -jf %Y-%m-%d "$1" +%A);
weekday=$(date -d "$1" +%A);
else
# By default, if there are no argument, it creates/open the current days' file.
year=$(date +%Y);
Expand Down Expand Up @@ -84,4 +84,4 @@ if [[ ! -f "$datename.md" ]]; then
vim "$datename.md";
else
vim "$datename.md";
fi
fi