Skip to content

Commit

Permalink
🔧 Chore: Format current date and timezone in shell script (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusla committed Oct 30, 2023
1 parent 1c98e89 commit 81c004a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-rocks-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kwchang0831/svelte-qwer': patch
---

🛠️ chore: Format current date and timezone in shell script
11 changes: 9 additions & 2 deletions utils/create-blog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if [ "$#" -ne 1 ]; then
exit 1
fi

# Get the current date in ISO 8601 format with timezone
CURRENT_DATE=$(date "+%Y-%m-%dT%H:%M:%S.000")
TIMEZONE_FORMATTED=$(date "+%z" | sed 's/\([0-9][0-9]\)\([0-9][0-9]\)/\1:\2/')


# Every time you enter pnpm run createblog YourDirName,
# a folder will be created for you based on the following configuration,
# along with a default content for index.md.
Expand All @@ -18,13 +23,15 @@ MD_TEMPLATE="---
title:
description:
summary:
published: '$CURRENT_DATE$TIMEZONE_FORMATTED'
updated: '$CURRENT_DATE$TIMEZONE_FORMATTED'
cover: ./cover.jpg
coverCaption: Photo by
coverStyle: 'IN'
series_tag:
series_title:
tag:
- [JavaSript]
- [svelte-QWER]
---"

# Ensure base path exists
Expand All @@ -39,4 +46,4 @@ else
mkdir "$DIRECTORY"
echo "$MD_TEMPLATE" > "$DIRECTORY/index.md"
echo "Directory $DIRECTORY and index.md created successfully!"
fi
fi

0 comments on commit 81c004a

Please sign in to comment.