Bug 798625 - "Last up through report date" changed in 4.12

Don't adjust report dates with time64CanonicalDayTime. They're set
to 23:59:59 local which is always >= neutral time at which prices
and transactions are timestamped. Local noon is before neutral time for
all time zones east of UTC+2.
This commit is contained in:
John Ralls 2023-01-07 03:49:48 +03:00
parent 2733d23b68
commit f7324d16b4
2 changed files with 6 additions and 10 deletions

View File

@ -739,7 +739,7 @@
(gnc-pricedb-get-db (gnc-get-current-book))
(gnc:gnc-monetary-amount foreign)
(gnc:gnc-monetary-commodity foreign)
domestic (time64CanonicalDayTime date))))))
domestic date)))))
(define (gnc:exchange-by-pricedb-nearest-before foreign domestic date)
(and (gnc:gnc-monetary? foreign) date
@ -751,7 +751,7 @@
(gnc-pricedb-get-db (gnc-get-current-book))
(gnc:gnc-monetary-amount foreign)
(gnc:gnc-monetary-commodity foreign)
domestic (time64CanonicalDayTime date))))))
domestic date)))))
;; Exchange by the nearest price from pricelist. This function takes
;; the <gnc-monetary> 'foreign' amount, the <gnc:commodity*>
@ -817,9 +817,9 @@
(define pdb (gnc-pricedb-get-db (gnc-get-current-book)))
(case source
((pricedb-nearest) (cut gnc-pricedb-get-nearest-price pdb <> target-curr
(time64CanonicalDayTime date)))
date))
((pricedb-before) (cut gnc-pricedb-get-nearest-before-price pdb <> target-curr
(time64CanonicalDayTime date)))
date))
((pricedb-latest) (cut gnc-pricedb-get-latest-price pdb <> target-curr))
(else
(lambda (commodity)

View File

@ -1316,17 +1316,13 @@ be excluded from periodic reporting.")
(opt-val pagename-currency
optname-currency)))
""))))
;; For conversion to row-currency. Use midday as the
;; transaction time so it matches a price on the same day.
;; Otherwise it uses midnight which will likely match a
;; price on the previous day
;; For conversion to row-currency.
(converted-amount (lambda (s)
(exchange-fn
(gnc:make-gnc-monetary (split-currency s)
(split-amount s))
(row-currency s)
(time64CanonicalDayTime
(xaccTransGetDate (xaccSplitGetParent s))))))
(xaccTransGetDate (xaccSplitGetParent s)))))
(converted-debit-amount (lambda (s) (and (positive? (split-amount s))
(converted-amount s))))
(converted-credit-amount (lambda (s)