-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/get acc info from monthly trans (#184)
* feat: add interface and mock * feat: add IsSameMonth * feat: get acc info from monthly trans * test: modify testing * fix: remove checking time range * feat: get acc info when no monthly trans --------- Co-authored-by: Eyo Chen <eyo.chen@amazingtalker.com>
- Loading branch information
Showing
11 changed files
with
286 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package domain | ||
|
||
import "time" | ||
|
||
// IsSameMonth returns true if the two given times are in the same month. | ||
func IsSameMonth(t1, t2 string) bool { | ||
date1, err := time.Parse(time.DateOnly, t1) | ||
if err != nil { | ||
return false | ||
} | ||
|
||
date2, err := time.Parse(time.DateOnly, t2) | ||
if err != nil { | ||
return false | ||
} | ||
|
||
return date1.Year() == date2.Year() && date1.Month() == date2.Month() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.