Yes, someone actually did this and I found it running on our server

You are viewing a single thread.
View all comments
25 points

weekend = dayOfWeek > 5

permalink
report
reply
-10 points
*

Sunday is 1 0 and Saturday is 7 6. You just made Friday part of the weekend You forgot Sunday

permalink
report
parent
reply
21 points

On which planet? Monday is 1

permalink
report
parent
reply
4 points

I was off by one, but Sunday is 0 in javascript

permalink
report
parent
reply
1 point
*

Depending on how you’re counting your integers, Monday is 0, being the first day of the week.

permalink
report
parent
reply
11 points
*

Both Monday and Sunday are used as the first day of the week with quite some regularity. It’s a completely arbitrary standard no different to "the tenth month is the one called “October”. Or dividing a day into 24 segments which are each broken into 60 smaller segments of 60 even smaller segments. You can’t say either is “wrong” per se.

Personally, I was brought up learning Sunday is the first day of the week, but at some point decided that was bullshit partly because it’s the week end. But also just from a practical standpoint when looking at a calendar, it’s useful to have the weekend days grouped together.

permalink
report
parent
reply
9 points

On planet America.

permalink
report
parent
reply
1 point

dayOfWeek is clearly represented by 1-7 in the example, with Sunday being 1.

So, I guess the answer is “depends on what date library you’re linking against”

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 3.2K

    Monthly active users

  • 1K

    Posts

  • 37K

    Comments