Сделал weekday для сообщения

This commit is contained in:
k.ukolov 2023-02-10 14:47:09 +07:00
parent f38fca44fb
commit 454f544bf3
2 changed files with 31 additions and 2 deletions

View File

@ -9,3 +9,31 @@ func Today(offset time.Duration) string {
}
return time.Now().In(location).Add(offset).Format("2006-01-02")
}
func GetTranslatedWeekday(date time.Time) string {
switch date.Weekday() {
case time.Monday:
return "Понедельник"
case time.Tuesday:
return "Вторник"
case time.Wednesday:
return "Среда"
case time.Thursday:
return "Четверг"
case time.Friday:
return "Пятница"
case time.Saturday:
return "Суббота"
case time.Sunday:
return "Воскресенье"
default:
return ""
}
}

View File

@ -5,6 +5,7 @@ import (
"math/rand"
"strconv"
"strings"
"student_bot/date"
"student_bot/new_year_service"
"student_bot/parser"
"time"
@ -60,7 +61,7 @@ func LessonsMessage(schedule []parser.Lesson, prefix, emptyText string) string {
s += "\n"
}
endDate = l.TimeStart.Format("02.01")
s += endDate + "\n"
s += endDate + " " + date.GetTranslatedWeekday(l.TimeStart) + "\n"
}
if strings.Contains(l.User, "Ярных В.В.") {
s += "⭐️ "