mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-16 12:00:12 +01:00
fix format date
This commit is contained in:
@@ -102,6 +102,23 @@ function optionPicked() {
|
||||
echo -e "${msg}\n"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Format date string
|
||||
# ARGS: $* (required): String
|
||||
# OUTS: String
|
||||
################################################################################
|
||||
format_date() {
|
||||
local date="${1}"
|
||||
local outf="${2}"
|
||||
local datef="${3:-"%b %d %H:%M:%S %Y %Z"}" # Tue Oct 24 13:34:22 2023 +0300
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
local resp="$(date -d "${date}" "+${outf}")"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
local resp="$(date -j -f "${datef}" "${date}" "+${outf}")"
|
||||
fi
|
||||
printf "%s" "${resp}"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Help information printed to stdout during non-interactive mode
|
||||
# ARGS: None
|
||||
@@ -394,7 +411,7 @@ function changelogs() {
|
||||
--date=short "${_author}" "$_since" "$_until" $_log_options $_pathspec \
|
||||
| sort -u -r | head -n $_limit \
|
||||
| while read DATE; do
|
||||
day=$(date -d $(echo $DATE|awk -F- '{print $1 "-" $2 "-" $3}') +%A)
|
||||
day=$(format_date "$DATE" "%A" "%Y-%m-%d")
|
||||
echo -e "\n[$DATE - $day]"
|
||||
GIT_PAGER=cat git -c log.showSignature=false log \
|
||||
--use-mailmap $_merges \
|
||||
|
||||
Reference in New Issue
Block a user