PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
200 stars 231 forks source link

Allow `ud_convert()` to work with class "difftime" (fix for #3012) #3168

Closed Aariq closed 1 year ago

Aariq commented 1 year ago

Description

Fixes #3012 . Checks if argument x is difftime, and if it is converts it to a units object with as_units(). Units are inferred from the class, so argument u1 isn't actually used in the conversion in this case. UI is a little weird here, but seems like this is mostly an internal function so probably better than adding argument defaults and allowing u1 to be NULL or something like that.

Motivation and Context

Review Time Estimate

Types of changes

Checklist:

Aariq commented 1 year ago

Looks great- just make sure to update the change log!

I can do this, but I'll just point out that the changelog already includes a bullet about this function being re-factored for this version. This bug was an unforseen side-effect of that refactoring