Skip to content

Commit d92a22f

Browse files
committed
fix: normalize UTC epoch conversion on macOS
1 parent 3fef7ff commit d92a22f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/lib/date-compat.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ date_to_epoch() {
2525
# Try GNU date
2626
date -u -d "$date_str" '+%s' 2>/dev/null && return
2727
# Try BSD date (macOS)
28-
date -u -j -f '%Y-%m-%d' "$date_str" '+%s' 2>/dev/null && return
28+
date -u -j -f '%Y-%m-%d %H:%M:%S' "${date_str} 00:00:00" '+%s' 2>/dev/null && return
2929
# Python fallback
30-
python3 -c "from datetime import datetime; print(int(datetime.strptime('$date_str', '%Y-%m-%d').timestamp()))" 2>/dev/null && return
30+
python3 -c "from datetime import datetime, timezone; print(int(datetime.strptime('$date_str', '%Y-%m-%d').replace(tzinfo=timezone.utc).timestamp()))" 2>/dev/null && return
3131
echo "0"
3232
}
3333

0 commit comments

Comments
 (0)