updating to reflect current period

main
KeeganForelight 2 years ago
parent c5672a5864
commit 613dfb9d25

@ -25,6 +25,8 @@ ARCHIVE_DIR="$TIMESHEET_DIR/archive"
TIMESHEET=$(ls "$TIMESHEET_DIR" | grep ".csv")
# generated by clock in
CURRENT_SESSION="$TIMESHEET_DIR/.session"
# first day of a pay period to base off of
STARTING_PERIOD="April-14-23"
createTimesheet() {
@ -34,8 +36,8 @@ createTimesheet() {
mkdir -p "$TIMESHEET_DIR"
fi
payperiods=$((($(date +%s) - $(date -d "Dec-30-22" +%s)) / (14*24*3600)))
period_end=$(date -d "Dec-30-22 + $((($payperiods + 1) * 14)) days" +%b-%d-%y)
payperiods=$((($(date +%s) - $(date -d "$STARTING_PERIOD" +%s)) / (14*24*3600)))
period_end=$(date -d "$STARTING_PERIOD + $((($payperiods + 1) * 14)) days" +%b-%d-%y)
TIMESHEET=$(printf "%s.csv" "$period_end")
# create timesheet
echo "Date, Time In, Time Out, Total Time (HH:MM)" > "${TIMESHEET_DIR}/${TIMESHEET}"

Loading…
Cancel
Save