Skip to content

Commit dace444

Browse files
authored
dont use first day from next month for month range (#8)
* dont use first day from next month for month range * release info
1 parent 49e76ff commit dace444

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [0.5.4] - 2024-03-29
10+
### Fixed
11+
- MonthRange function returned first day of next month which causes invalid summaries
12+
913
## [0.5.3] - 2024-03-27
1014
### Fixed
1115
- calendar controls not working while focus is on latest issues view
@@ -85,7 +89,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8589
### Added
8690
- Initial release of gojira
8791

88-
[Unreleased]: https://github.com/jzyinq/gojira/compare/0.5.3...master
92+
[Unreleased]: https://github.com/jzyinq/gojira/compare/0.5.4...master
93+
[0.5.4]: https://github.com/jzyinq/gojira/compare/0.5.3...0.5.4
8994
[0.5.3]: https://github.com/jzyinq/gojira/compare/0.5.2...0.5.3
9095
[0.5.2]: https://github.com/jzyinq/gojira/compare/0.5.1...0.5.2
9196
[0.5.1]: https://github.com/jzyinq/gojira/compare/0.5.0...0.5.1

gojira/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ func OpenURL(url string) {
114114

115115
func MonthRange(t *time.Time) (time.Time, time.Time) {
116116
firstDayOfCurrentMonth := time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location())
117-
firstDayOfNextMonth := firstDayOfCurrentMonth.AddDate(0, 1, 0)
118-
return firstDayOfCurrentMonth, firstDayOfNextMonth
117+
lastDayOfCurrentMonth := firstDayOfCurrentMonth.AddDate(0, 1, 0).Add(-time.Second)
118+
return firstDayOfCurrentMonth, lastDayOfCurrentMonth
119119
}

gojira/worklog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (wl *WorkLogs) TotalTimeSpentToPresentDay() int {
112112
if err != nil {
113113
logrus.Error(err)
114114
}
115-
if logDate.Before(time.Now().Local()) {
115+
if logDate.Before(time.Now().UTC()) {
116116
totalTime += log.TimeSpentSeconds
117117
}
118118
}

0 commit comments

Comments
 (0)