This short AppleScript using weekday is not working as expected
Solution 1:
I'm not sure it's really something you'd ever guess without being told, but Applescript has its own Date class which means the quotes are not required. It will report like a string, but you don't need to refer to it as one.
So all you need is this…
set currentDay to weekday of (current date)
if currentDay = Monday or currentDay = Tuesday or currentDay = Wednesday then
set earlymorningDisc to 1
else if currentDay = Thursday or currentDay = Friday then
set earlymorningDisc to 2
else
set earlymorningDisc to 3
end if
If you try this in the editor where you can see the Result in the lower pane
set currentDay to weekday of (current date)
return currentDay
You'll see it responds with Friday
whereas if you try
set currentDay to weekday of (current date) as string
return currentDay
You'll see it now responds with "Friday"
in quotes.
BTW, you can concatenate your multiple ifs, rather than
if currentDay = Monday or currentDay = Tuesday or currentDay = Wednesday
you can use a list…
if currentDay is in {Monday, Tuesday, Wednesday}