Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have recently been on the other side of this argument for specific case.

In our case we (users of our API) are to specify date ranges, representing a list of partitions. So we are not counting nights between dates, but rather a set of daily or hourly buckets.

Here (maybe even only here) I argue that inclusive ranges feel more intuitive.

I find it much more intuitive to represent the 1st 7 days of January as

['2022-01-01', '2022-01-07']

compared to

['2022-01-01', '2022-01-08').

Another very common example is to specify the last 7 days (incl 'today') in which case I find

[today().minusDays(6), today()]

to be a clearer representation than

['today().minusDays(6)', 'today().plusDays(1)')



Your 1st 7 days still works with an open interval:

['2022-01-01', '2022-01-01' + days(7) )

Also, isn't this 6 days?

[today().minusDays(6), today()] --> ['2022-11-16', '2022-11-22']

To be fair, I'm considering these dates/times as singular points in time to the smallest resolution available in whatever time system is being used.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: