3

Does the chosen end date stop at 0:00 (exclusive) or 23:59:59 (inclusive)?

I have been changing datepickers in my company's codebase to be inclusive (assuming it was just a UX oversight by other devs), but it made me wonder whether it was just my preference more so than a convention.

Do users expect datepickers to be inclusive or exclusive, and what are the exceptions? Does the same hold true when choosing just month or year?

  • 1
    24:00 in ISO 8601 – Crissov Nov 16 '16 at 9:23
  • You might want to specify this is for searching/filtering only as for actual field input it is exactly as specified. – scunliffe Nov 16 '16 at 11:38
3

I think it depends a bit on the audience.

If I talk to my DBA, s/he wants me to be very explicit as to which I want.

However if I create a UI for the general public, the inclusive (IMHO) makes more sense to how "regular people" think.

E.g. If I asked a 100 users what they would expect if they picked this filter:

Show all events:
[_Oct_1,_2016_] to [_Oct_7,_2016_]

Most would expect any event on ANY of those 7 days to be included.

2

I'd say inclusive, simply because if I pick a date or date range I'm thinking about that specific time or range. If I wanted a time range between 2am and 3am I wouldn't want to put 01:59:59 - 03:00:01.

Whatever choice you make, make sure you are constant across your code base. Once you've established a standard in your project, breaking that, especially with picking dates like this, can cause a lot of confusion and problems.

0

It all depends on the audience.

If your application/code is exposed to normal people than go "exclusive". There are probably very few cases where the normal people will think "inclusive".

Example one: Let's meet at midnight today. To you that will mean 00:00 even if considering the technical side that will be tomorrow, right?

Example two: If I am interested in a payment I've made yesterday as a normal person yesterday means from 00:00 to 00:00 today considering that transaction was completed before 00:00 today.

Of course if the context says for the audience 23:59:59 is a completely different thing than 00:00 - you could consider "inclusive" in this case.

The bottom line is to realize how the users of your end app think and help them as much as possible - relevance and simplicity over anything else.

0

Half open: start <= x < end

If you have two consecutive intervals, you want their intersection to be empty, and their union to include all the hits.

Example: A user wants to see all the transactions she's made on Tuesday and, in a separate query, all the transactions she's made on Wednesday. She would not want to see the transaction she's made at midnight (between Tuesday and Wednesday) twice (as a result of both queries).

  • Could you expand on this answer? – Mayo May 15 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.