Skip to content

Commit

Permalink
2022-08-04 15:22:39 time.ParseInLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
shenguanjiejie committed Aug 4, 2022
1 parent 402b11a commit 3ffe24b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"host": "127.0.0.1",
"mode": "debug",
"program": "${workspaceFolder}/main.go",
"showLog": true
"showLog": true,
// "args": ["base64","-d","-i","~/Desktop/base64.txt"]
"args": ["time","20220802"]
}
]
}
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

version="0.0.2"
version="0.0.3"

GOOS=linux GOARCH=amd64 go build -o ww
tar -zcvf workwork_${version}_linux_x86_64.tar.gz ww
Expand All @@ -13,3 +13,5 @@ rm ww
GOOS=darwin GOARCH=amd64 go build -o ww
tar -zcvf workwork_${version}_darwin.tar.gz ww

shasum -a 256 workwork_${version}_darwin.tar.gz

2 changes: 1 addition & 1 deletion cmd/readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var readmeCmd = &cobra.Command{
Long: `readme`,
Run: func(cmd *cobra.Command, args []string) {
worksAnchor, works := works()
version := "0.0.2"
version := "0.0.3"
download := "or<br><br>[Download](https://github.com/shenguanjiejie/workwork/releases), Unpack, and move \"ww\" to /usr/local/bin.<br>到[release页面](https://github.com/shenguanjiejie/workwork/releases)下载后, 解压出ww文件, 放在/usr/local/bin目录下即可\n"
macInstall := fmt.Sprintf("# Install\n### Mac\n```shell\nbrew install shenguanjiejie/tap/workwork\n```\nor\n```shell\ncurl -LO https://github.com/shenguanjiejie/workwork/releases/download/v%s/workwork_%s_darwin.tar.gz && tar -zxvf ./workwork_%s_darwin.tar.gz && mv ./ww /usr/local/bin && rm ./workwork_%s_darwin.tar.gz\n```\n%s", version, version, version, version, download)
linuxInstall := fmt.Sprintf("### Linux\n```shell\ncurl -LO https://github.com/shenguanjiejie/workwork/releases/download/v%s/workwork_%s_linux_x86_64.tar.gz && tar -zxvf ./workwork_%s_linux_x86_64.tar.gz && mv ./ww /usr/local/bin && rm ./workwork_%s_linux_x86_64.tar.gz\n```\n%s", version, version, version, version, download)
Expand Down
4 changes: 2 additions & 2 deletions cmd/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var timeCmd = &cobra.Command{
} else {
// RJ 2022-07-05 21:25:49 20060102150405格式时间转换
layout := timeFormats[0][:length]
date, err = time.Parse(layout, arg)
date, err = time.ParseInLocation(layout, arg, time.Local)
if err != nil {
tools.Slogln("错误的时间格式")
continue
Expand All @@ -114,7 +114,7 @@ var timeCmd = &cobra.Command{
}
}
layout := timeFormats[0][:len(dateStr)]
date, err = time.Parse(layout, dateStr)
date, err = time.ParseInLocation(layout, dateStr, time.Local)
if err != nil {
tools.Slogln("错误的时间格式")
continue
Expand Down

0 comments on commit 3ffe24b

Please sign in to comment.