gvol / emacs-memento-mori

Reminder of mortality
https://melpa.org/#/memento-mori
ISC License
31 stars 10 forks source link

Incorrect age shown #14

Closed doolio closed 6 months ago

doolio commented 10 months ago

Tomorrow is my birthday but the age shown today matches what my age will be tomorrow.

gvol commented 9 months ago

Can you share the relevant config so that I can test it?

Is it possible that it just rounded up (legitimately)?

lassik commented 9 months ago

memento-mori-age returns a float which is rounded into 2 decimal places by format "%.2f" in memento-mori-update.

memento-mori-age uses truncate which always rounds down. But format probably rounds toward nearest.

doolio commented 9 months ago

Sure.

(use-package memento-mori               ; Reminder of one's mortality.
  :demand t                             ; As I lazy load by default.
  :init (setq memento-mori-birth-date "2022-12-21") ; Shows as 1.00 years old.
  ;;:init (setq memento-mori-birth-date "2023-12-19") ; Shows as 0.00 years old but should be > 0 (today being 2023-12-20), no?
  :config (memento-mori-mode))

Is it possible that it just rounded up (legitimately)?

A whole 24hrs in advance?

Edit: Update comment.

lassik commented 9 months ago

Note: 365.2425 is the average length of a year, taking leap years into account.

These are slightly different questions to ask:

1) How old are you in average years? 2) How old are you according to the calendar?

lassik commented 9 months ago

A whole 24hrs in advance?

The time of day is truncated to 0, only the day is used. This may not be the right choice.

doolio commented 9 months ago

Didn't see your reply before posting.

memento-mori-age uses truncate which always rounds down. But format probably rounds toward nearest. The time of day is truncated to 0, only the day is used.

And probably explains my observation.

gvol commented 6 months ago

I'm going to go ahead and close this. Please feel free to reopen if you still have a question.

doolio commented 6 months ago

The time of day is truncated to 0, only the day is used. This may not be the right choice.

if you still have a question.

Only whether you agree this is the right choice?