Merge branch 'main' of github.com:mrusme/zeit

This commit is contained in:
マリウス 2021-02-07 14:02:40 -04:00
commit 31014917ef
No known key found for this signature in database
GPG key ID: C228EF0A530AF06F
2 changed files with 16 additions and 3 deletions

View file

@ -272,3 +272,10 @@ Export a Tyme 3 JSON:
```sh ```sh
zeit export --format tyme --project "my project" --since "2020-04-01T15:04:05+07:00" --until "2020-04-04T15:04:05+07:00" zeit export --format tyme --project "my project" --since "2020-04-01T15:04:05+07:00" --until "2020-04-04T15:04:05+07:00"
``` ```
## Integrations
Here are a few integrations and extensions built by other people that make use of `zeit`:
- [`zeit-status.sh`](https://github.com/khughitt/dotfiles/blob/master/polybar/scripts/zeit-status.sh), a [Polybar](https://github.com/polybar/polybar) integration for `zeit` by [@khughitt](https://github.com/khughitt) (see [#1](https://github.com/mrusme/zeit/issues/1))
- your link here, feel free to PR! :-)

View file

@ -65,7 +65,6 @@ func RelToTime(timeStr string, ftId int) (time.Time, error) {
return time.Now(), errors.New("No match") return time.Now(), errors.New("No match")
} }
var hours int = 0 var hours int = 0
var minutes int = 0 var minutes int = 0
@ -92,11 +91,17 @@ func RelToTime(timeStr string, ftId int) (time.Time, error) {
func ParseTime(timeStr string) (time.Time, error) { func ParseTime(timeStr string) (time.Time, error) {
tfId := GetTimeFormat(timeStr) tfId := GetTimeFormat(timeStr)
t:= time.Now()
switch tfId { switch tfId {
case TFAbsTwelveHour: case TFAbsTwelveHour:
return time.Parse("3:04pm", timeStr) tadj, err := time.Parse("3:04pm", timeStr)
tnew := time.Date(t.Year(), t.Month(), t.Day(), tadj.Hour(), tadj.Minute(), t.Second(), t.Nanosecond(), t.Location())
return tnew, err
case TFAbsTwentyfourHour: case TFAbsTwentyfourHour:
return time.Parse("15:04", timeStr) tadj, err := time.Parse("15:04", timeStr)
tnew := time.Date(t.Year(), t.Month(), t.Day(), tadj.Hour(), tadj.Minute(), t.Second(), t.Nanosecond(), t.Location())
return tnew, err
case TFRelHourMinute, TFRelHourFraction: case TFRelHourMinute, TFRelHourFraction:
return RelToTime(timeStr, tfId) return RelToTime(timeStr, tfId)
default: default:
@ -160,3 +165,4 @@ func GetGitLog(repo string, since time.Time, until time.Time) (string, string, e
stdoutStr, stderrStr := string(stdout.Bytes()), string(stderr.Bytes()) stdoutStr, stderrStr := string(stdout.Bytes()), string(stderr.Bytes())
return stdoutStr, stderrStr, nil return stdoutStr, stderrStr, nil
} }