2022-03-05 18:02:55 +00:00
|
|
|
package date
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2023-01-10 19:00:07 +00:00
|
|
|
func Today(offset time.Duration) string {
|
2022-09-04 12:54:04 +00:00
|
|
|
location, err := time.LoadLocation("Asia/Novosibirsk")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-02-10 07:47:09 +00:00
|
|
|
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 ""
|
|
|
|
}
|
2022-03-05 18:02:55 +00:00
|
|
|
}
|