github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/time/utc/weekday.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package utc 4 5 import ( 6 "../../protocol" 7 ) 8 9 // A Weekdays specifies a day of the week. 10 // can use by multiple state e.g. Weekdays_Saturday|Weekdays_Monday 11 type Weekdays uint8 12 13 // Weekdays 14 const ( 15 Weekdays_None Weekdays = 0b00000000 16 Weekdays_Monday Weekdays = 0b00000001 17 Weekdays_Tuesday Weekdays = 0b00000010 18 Weekdays_Wednesday Weekdays = 0b00000100 19 Weekdays_Thursday Weekdays = 0b00001000 20 Weekdays_Friday Weekdays = 0b00010000 21 Weekdays_Saturday Weekdays = 0b00100000 22 Weekdays_Sunday Weekdays = 0b01000000 23 Weekdays_All Weekdays = 0b11111111 24 ) 25 26 // Check given day exist in desire days 27 func (w Weekdays) Check(day Weekdays) (exist bool) { return day&w != 0 } 28 29 // Check given day exist in desire Weekdays! 30 func (wd Weekdays) String() (day string) { 31 switch protocol.AppLanguage { 32 case protocol.LanguageEnglish: 33 switch wd { 34 case Weekdays_Monday: 35 return "Monday" 36 case Weekdays_Tuesday: 37 return "Tuesday" 38 case Weekdays_Wednesday: 39 return "Wednesday" 40 case Weekdays_Thursday: 41 return "Thursday" 42 case Weekdays_Friday: 43 return "Friday" 44 case Weekdays_Saturday: 45 return "Saturday" 46 case Weekdays_Sunday: 47 return "Sunday" 48 } 49 case protocol.LanguagePersian: 50 switch wd { 51 case Weekdays_Monday: 52 return "دوشنبه" 53 case Weekdays_Tuesday: 54 return "سه شنبه" 55 case Weekdays_Wednesday: 56 return "چهارشنبه" 57 case Weekdays_Thursday: 58 return "پنچ شنبه" 59 case Weekdays_Friday: 60 return "جمعه" 61 case Weekdays_Saturday: 62 return "شنبه" 63 case Weekdays_Sunday: 64 return "یکشنبه" 65 } 66 } 67 return 68 }