-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaydaybeer.go
More file actions
48 lines (36 loc) · 1.15 KB
/
paydaybeer.go
File metadata and controls
48 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(checkPaydayBeerSituation(time.Now()))
}
func isPaydayWeek(beertime time.Time) bool {
return (18 - beertime.Day()) < 7 && beertime.Weekday() <= 5
}
func isBeerday(beertime time.Time) bool {
return beertime.Weekday() == time.Friday
}
func isBeerOClock(beertime time.Time) bool {
return isBeerday(beertime) && beertime.Hour() >= 16
}
func isWeekend(weekend time.Time) bool {
return weekend.Weekday() == 6 || weekend.Weekday() == 7
}
func checkPaydayBeerSituation(possibleBeerOClock time.Time) string {
switch {
case isWeekend(possibleBeerOClock) :
return "Have a nice weekend!"
case isPaydayWeek(possibleBeerOClock) && isBeerday(possibleBeerOClock) :
return "Yesss! 🍺 it is time for Pay 🍹 Day 🍸 Beer! 🍻"
case isPaydayWeek(possibleBeerOClock) && !isBeerday(possibleBeerOClock):
return "Patience, good things and money will come... ⏳ "
case isBeerOClock(possibleBeerOClock) :
return "Weekend here I come! Someones up for a 🍺 ?"
case isBeerday(possibleBeerOClock) :
return "Getting thirsty for🍺 ?"
default:
return "Back 😰 to work... 👷🏼"
}
}