calendar display type supports Gregorian with Persian, date display type supports Persian calendar

This commit is contained in:
MaysWind
2025-09-06 23:02:09 +08:00
parent 757f9e5b02
commit a469d66358
24 changed files with 209 additions and 20 deletions
+6
View File
@@ -11,6 +11,7 @@ const (
CALENDAR_DISPLAY_TYPE_GREGORAIN CalendarDisplayType = 1
CALENDAR_DISPLAY_TYPE_BUDDHIST CalendarDisplayType = 2
CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_CHINESE CalendarDisplayType = 3
CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_PERSIAN CalendarDisplayType = 4
CALENDAR_DISPLAY_TYPE_INVALID CalendarDisplayType = 255
)
@@ -25,6 +26,8 @@ func (f CalendarDisplayType) String() string {
return "Buddhist"
case CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_CHINESE:
return "Gregorian with Chinese"
case CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_PERSIAN:
return "Gregorian with Persian"
case CALENDAR_DISPLAY_TYPE_INVALID:
return "Invalid"
default:
@@ -40,6 +43,7 @@ const (
DATE_DISPLAY_TYPE_DEFAULT DateDisplayType = 0
DATE_DISPLAY_TYPE_GREGORAIN DateDisplayType = 1
DATE_DISPLAY_TYPE_BUDDHIST DateDisplayType = 2
DATE_DISPLAY_TYPE_PERSIAN DateDisplayType = 3
DATE_DISPLAY_TYPE_INVALID DateDisplayType = 255
)
@@ -52,6 +56,8 @@ func (f DateDisplayType) String() string {
return "Gregorian"
case DATE_DISPLAY_TYPE_BUDDHIST:
return "Buddhist"
case DATE_DISPLAY_TYPE_PERSIAN:
return "Persian"
case DATE_DISPLAY_TYPE_INVALID:
return "Invalid"
default:
+2 -2
View File
@@ -199,8 +199,8 @@ type UserProfileUpdateRequest struct {
DefaultCurrency string `json:"defaultCurrency" binding:"omitempty,len=3,validCurrency"`
FirstDayOfWeek *core.WeekDay `json:"firstDayOfWeek" binding:"omitempty,min=0,max=6"`
FiscalYearStart *core.FiscalYearStart `json:"fiscalYearStart" binding:"omitempty,validFiscalYearStart"`
CalendarDisplayType *core.CalendarDisplayType `json:"calendarDisplayType" binding:"omitempty,min=0,max=3"`
DateDisplayType *core.DateDisplayType `json:"dateDisplayType" binding:"omitempty,min=0,max=2"`
CalendarDisplayType *core.CalendarDisplayType `json:"calendarDisplayType" binding:"omitempty,min=0,max=4"`
DateDisplayType *core.DateDisplayType `json:"dateDisplayType" binding:"omitempty,min=0,max=3"`
LongDateFormat *core.LongDateFormat `json:"longDateFormat" binding:"omitempty,min=0,max=3"`
ShortDateFormat *core.ShortDateFormat `json:"shortDateFormat" binding:"omitempty,min=0,max=3"`
LongTimeFormat *core.LongTimeFormat `json:"longTimeFormat" binding:"omitempty,min=0,max=3"`
+2 -2
View File
@@ -293,11 +293,11 @@ func (s *UserService) UpdateUser(c core.Context, user *models.User, modifyUserLa
updateCols = append(updateCols, "fiscal_year_start")
}
if core.CALENDAR_DISPLAY_TYPE_DEFAULT <= user.CalendarDisplayType && user.CalendarDisplayType <= core.CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_CHINESE {
if core.CALENDAR_DISPLAY_TYPE_DEFAULT <= user.CalendarDisplayType && user.CalendarDisplayType <= core.CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_PERSIAN {
updateCols = append(updateCols, "calendar_display_type")
}
if core.DATE_DISPLAY_TYPE_DEFAULT <= user.DateDisplayType && user.DateDisplayType <= core.DATE_DISPLAY_TYPE_BUDDHIST {
if core.DATE_DISPLAY_TYPE_DEFAULT <= user.DateDisplayType && user.DateDisplayType <= core.DATE_DISPLAY_TYPE_PERSIAN {
updateCols = append(updateCols, "date_display_type")
}