Skip to content

multiplyDuration doesn't handle fractions of 1 #10

@justincy

Description

@justincy

GedcomXDate.multiplyDuration('1Y1M1D', .5) will do nothing. This is because it handles the parts completely independently and rounds. So half of 1Y is .5Y which gets rounded back to 1Y.

I don't know how to handle this. What is half of one month? It depends on which month. Same with years, some have more days than others. I'll investigate how other date libraries deal with this. It's straightforward (though not fun) when you have some reference point so that you know which year or month you're dealing with, but you don't get that with generic durations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions