fix(date): ensure Linux date utility returns UTC timestamps
Add -u flag to GNU date command in get_iso_timestamp() to match the macOS implementation and function documentation. Both platforms now consistently return UTC timestamps in YYYY-MM-DDTHH:MM:SS+00:00 format. Before: date -Iseconds (returned local time on Linux) After: date -u -Iseconds (returns UTC on Linux)
This commit is contained in:
parent
3d7db2c3ae
commit
70279c017e
1 changed files with 2 additions and 2 deletions
|
|
@ -14,8 +14,8 @@ get_iso_timestamp() {
|
||||||
# Use manual formatting and add colon to timezone offset
|
# Use manual formatting and add colon to timezone offset
|
||||||
date -u +"%Y-%m-%dT%H:%M:%S%z" | sed 's/\(..\)$/:\1/'
|
date -u +"%Y-%m-%dT%H:%M:%S%z" | sed 's/\(..\)$/:\1/'
|
||||||
else
|
else
|
||||||
# Linux (GNU date)
|
# Linux (GNU date) - use -u flag for UTC
|
||||||
date -Iseconds
|
date -u -Iseconds
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue