From 49be7bab7ebba65d7b3a314ec4af3b47ebbd2d30 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 19 Feb 2026 06:54:16 +0100 Subject: feat: Improve the dateiso function to manage multiple format --- functions/dateiso.fish | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'functions') diff --git a/functions/dateiso.fish b/functions/dateiso.fish index 304d753..3d15458 100644 --- a/functions/dateiso.fish +++ b/functions/dateiso.fish @@ -1,2 +1,18 @@ -alias 'dateiso'='date --iso-8601=seconds' -# Can also be taped `date -Is` +function dateiso --wraps='date' --description 'Utils around date' + switch $argv[1] + case no-tz + date +"%Y-%m-%dT%H:%M:%S" -u + case no-tz-local + date +"%Y-%m-%dT%H:%M:%S" + case timestamp + date +"%Y-%m-%dT%H:%M:%S" -d "@$argv[2]" + case email + # + date --rfc-email + case help + echo -e "Options: \nno-tz => Without timezone \nno-tz-local => without timezone but local \ntimestamp => Convert a timestamp to ISO \nemail => date format email ! Not ISO 8601 !" + case '*' + date --iso-8601=seconds + # Can also be taped `date -Is` + end +end -- cgit v1.3-2-g11bf