From 12c4c3556704a0b5bb3fa3aebbb3964219fe455f Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 10 Mar 2023 12:23:42 -0500 Subject: [PATCH] fix dates on mac --- spiffworkflow-frontend/bin/cypress_pilot | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-frontend/bin/cypress_pilot b/spiffworkflow-frontend/bin/cypress_pilot index f69dae06..ecf50455 100755 --- a/spiffworkflow-frontend/bin/cypress_pilot +++ b/spiffworkflow-frontend/bin/cypress_pilot @@ -37,7 +37,7 @@ if [[ ! -f "$cypress_run_file" ]]; then echo "success,duration,start_time,end_time,frontend_url" >"$cypress_run_file" fi -frontend_url="${SPIFFWORKFLOW_FRONTEND_URL:localhost}" +frontend_url="${SPIFFWORKFLOW_FRONTEND_URL:-localhost}" for attempt in $(seq 1 "$ATTEMPTS" ); do echo "Running attempt: ${attempt}" @@ -48,7 +48,14 @@ for attempt in $(seq 1 "$ATTEMPTS" ); do success="true" fi end_time=$(date +%s) + if is_mac; then + formatted_start_time=$(date -r "${start_time}" +"%Y-%m-%dT%H-%M-%S") + formatted_end_time=$(date -r "${end_time}" +"%Y-%m-%dT%H-%M-%S") + else + formatted_start_time=$(date "-d@${start_time}" +"%Y-%m-%dT%H-%M-%S") + formatted_end_time=$(date "-d@${end_time}" +"%Y-%m-%dT%H-%M-%S") + fi - echo "${success},$(( end_time - start_time )),$(date "-d@${start_time}"),$(date "-d@${end_time}"),${frontend_url}" >>"$cypress_run_file" + echo "${success},$(( end_time - start_time )),${formatted_start_time},${formatted_end_time},${frontend_url}" >>"$cypress_run_file" done echo "Recorded stats to ${cypress_run_file}"