Open Ghost-Terms opened 1 year ago
Looking at it, it seems like the dehumanize only supports the plurals.
@anishnya any insight on this one?
We use the humanize output and reverse it for dehumanize.
arrow.now().dehumanize("a day ago").isoformat()
will work since that's what humanize produces. Humanize doesn't ever produce the "1 days ago" output, hence we don't have that mapping in there.
We certainly could add this translation in for English, but ideally we would want similar mappings across all languages. I'm open to making this a broader issue and attempting to solve it.
I came here looking for a solution to this issue.
arrow.now().dehumanize("1 hour ago").isoformat()
throws the following error:
ValueError: Input string not valid. Note: Some locales do not support the week granularity in Arrow. If you are attempting to use the week granularity on an unsupported locale, this could be the cause of this error.
whereas arrow.now().dehumanize("1 hours ago").isoformat()
does work but the plural hours
doesn't make grammatical sense in this case.
@anishnya As @ben-kenney points out, your comment doesn't address the issue. While I can understand that 1 days ago
might not be valid, 1 day ago
should be, but the latter throws a ValueError
.
Yeah, it's worth pointing out again that dehumanize implies that the string is already humanized, but it's hard to say "1 days ago" is considered humanized.
arrow.now().dehumanize("1 day ago").isoformat()
doesn't work.arrow.now().dehumanize("1 days ago").isoformat()
does work.Same with
week
,month
, andyear
.