Hacker News new | ask | show | jobs
by cedricd 1819 days ago
If I'm understanding correctly you think the boundary crossing thing is weird. Like why would it say that Jan 1st 2021 - Dec 31 2020 is 1 year, when it's more like 1/365 of a year.

I'm not necessarily the best person to defend it, but I think it has a couple nice properties.

1. it's an integer, so can be used in group_by, comparisons, bucketing, etc

2. it aligns to commonly understood boundaries, which helps with the above.

Another way to look at the boundary issue is that it only matters when things are close. If you get a 1 and don't like it, drop down a unit (year -> months or days) instead.

Comparing years the way I did above is obviously a bit of an edge case