From 08520fec143abd63000885f9d8fadb66ef203435 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 26 May 2022 21:06:02 +0200 Subject: Make datetime pass on -u in all cases --- CHANGELOG.md | 1 + lib/util.bash | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe97d4..523c4c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `pkg_*()` functions no longer _require_ a `pkg.*` value to be defined. If one is not set explicitly, a warning will be generated, but the original name passed to the `pkg_*()` function will be used by the host's package manager. +- `datetime()` now always passes `-u` on to `date`. ## [1.0.0] - 2022-05-06 diff --git a/lib/util.bash b/lib/util.bash index da491bb..6ad69e1 100644 --- a/lib/util.bash +++ b/lib/util.bash @@ -24,14 +24,15 @@ chgdir() { datetime() { local date_opts + date_opts+=("-u") + # Apply SOURCE_DATE_EPOCH as the date to base off of. if [[ $SOURCE_DATE_EPOCH ]] then date_opts+=("-d@$SOURCE_DATE_EPOCH") - date_opts+=("-u") fi - date "${date_opts[@]}" +"${1:-%FT%T}" + date "${date_opts[@]}" +"${1:-%FT%TZ}" } # Log a message as error, and exit the program. This is intended for serious -- cgit v1.1