fix timezones
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steven Polley 2023-11-13 16:30:59 -07:00
parent 77e467071b
commit 4ff4c62daf

View File

@ -70,7 +70,7 @@ func (c *Client) GetAccountTransactions(accountID string, sinceDate time.Time) (
// Accepts a YNAB account ID and returns the transaction ID, amount and an error for the
// the first transaction found with Payee Name "Capital Gains or Losses"
func (c *Client) getTodayYnabCapitalGainsTransaction(accountID string) (string, int, error) {
ynabTransactions, err := c.GetAccountTransactions(accountID, time.Now())
ynabTransactions, err := c.GetAccountTransactions(accountID, time.Now().In(c.loc))
if err != nil {
return "", 0, fmt.Errorf("failed to get ynab transactions: %v", err)
}
@ -89,7 +89,7 @@ func (c *Client) createTodayYNABCapitalGainsTransaction(accountID string, amount
transaction := TransactionRequest{}
transaction.Transaction.AccountID = accountID
transaction.Transaction.Amount = amount
transaction.Transaction.Date = time.Now().Format("2006-01-02")
transaction.Transaction.Date = time.Now().In(c.loc).Format("2006-01-02")
transaction.Transaction.Cleared = "cleared"
transaction.Transaction.Approved = true
transaction.Transaction.PayeeName = "Capital Gains or Losses"
@ -110,7 +110,7 @@ func (c *Client) updateTodayYNABCapitalGainsTransaction(accountID string, transa
transaction.Transaction.AccountID = accountID
transaction.Transaction.ID = transactionID
transaction.Transaction.Amount = amount
transaction.Transaction.Date = time.Now().Format("2006-01-02")
transaction.Transaction.Date = time.Now().In(c.loc).Format("2006-01-02")
transaction.Transaction.Cleared = "cleared"
transaction.Transaction.Approved = true
transaction.Transaction.PayeeName = "Capital Gains or Losses"