summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2026-02-19 06:54:16 +0100
committerache <ache@ache.one>2026-02-19 06:54:16 +0100
commit49be7bab7ebba65d7b3a314ec4af3b47ebbd2d30 (patch)
tree7789498d32694950bf407613b1e5c9102259741f
parentfeat: Uses `env` when reading commit message from `/tmp/prev-ia-commit-message` (diff)
feat: Improve the dateiso function to manage multiple format
-rw-r--r--functions/dateiso.fish20
1 files changed, 18 insertions, 2 deletions
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