mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
fixed timezones
This commit is contained in:
@@ -89,10 +89,10 @@ func (as *WalletService) GetHeader(am *models.Auth, embed string, walletId strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, sub := range *subscriptions {
|
for _, sub := range *subscriptions {
|
||||||
startDate := sub.StartDate
|
startDate := sub.StartDate.Local()
|
||||||
stopDate := firstOfMonthAfterNext
|
stopDate := firstOfMonthAfterNext
|
||||||
if sub.HasEnd {
|
if sub.HasEnd {
|
||||||
stopDate = sub.EndDate
|
stopDate = sub.EndDate.Local()
|
||||||
}
|
}
|
||||||
for startDate.Before(stopDate) {
|
for startDate.Before(stopDate) {
|
||||||
trans := sub.ToTrans()
|
trans := sub.ToTrans()
|
||||||
@@ -115,19 +115,19 @@ func (as *WalletService) GetHeader(am *models.Auth, embed string, walletId strin
|
|||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for _, trans := range wallet.Transactions {
|
for _, trans := range wallet.Transactions {
|
||||||
if trans.TransactionDate.Before(firstOfNextMonth) && trans.TransactionDate.After(firstOfMonth) {
|
if trans.TransactionDate.Local().Before(firstOfNextMonth) && trans.TransactionDate.Local().After(firstOfMonth) {
|
||||||
if trans.TransactionType.Type == "expense" {
|
if trans.TransactionType.Type == "expense" {
|
||||||
currentBalance -= trans.Amount
|
currentBalance -= trans.Amount
|
||||||
} else {
|
} else {
|
||||||
currentBalance += trans.Amount
|
currentBalance += trans.Amount
|
||||||
}
|
}
|
||||||
} else if trans.TransactionDate.Before(firstOfMonthAfterNext) && trans.TransactionDate.After(firstOfNextMonth) {
|
} else if trans.TransactionDate.Local().Before(firstOfMonthAfterNext) && trans.TransactionDate.Local().After(firstOfNextMonth) {
|
||||||
if trans.TransactionType.Type == "expense" {
|
if trans.TransactionType.Type == "expense" {
|
||||||
nextMonth -= trans.Amount
|
nextMonth -= trans.Amount
|
||||||
} else {
|
} else {
|
||||||
nextMonth += trans.Amount
|
nextMonth += trans.Amount
|
||||||
}
|
}
|
||||||
} else if trans.TransactionDate.Before(firstOfMonth) {
|
} else if trans.TransactionDate.Local().Before(firstOfMonth) {
|
||||||
if trans.TransactionType.Type == "expense" {
|
if trans.TransactionType.Type == "expense" {
|
||||||
lastMonthBalance -= trans.Amount
|
lastMonthBalance -= trans.Amount
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user