diff --git a/ynab/transactions.go b/ynab/transactions.go index 9c5bfdd..7d8b6d3 100644 --- a/ynab/transactions.go +++ b/ynab/transactions.go @@ -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"