Fixed bug number 9763.
This commit is contained in:
parent
ccec0201e2
commit
ac74e6d5db
|
@ -1045,7 +1045,36 @@ void Option_Operating_Time_Key(lv_obj_t* obj, uint32_t key)
|
|||
break;
|
||||
}
|
||||
}
|
||||
UINT16 sf_get_month_days(UINT16 year, UINT16 month)
|
||||
{
|
||||
UINT16 maxday = 0;
|
||||
|
||||
printf("sf_get_month_days year=%d, month=%d\n", year, month);
|
||||
|
||||
switch(month)
|
||||
{
|
||||
case 4:
|
||||
case 6:
|
||||
case 9:
|
||||
case 11:
|
||||
maxday = 30;
|
||||
break;
|
||||
case 2:
|
||||
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
|
||||
maxday = 29;
|
||||
else
|
||||
maxday = 28;
|
||||
|
||||
break;
|
||||
default:
|
||||
maxday = 31;
|
||||
break;
|
||||
}
|
||||
|
||||
printf("maxday=%d\n", maxday);
|
||||
|
||||
return maxday;
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
// DateTime
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -1084,7 +1113,10 @@ static void update_DateTime_Time_msg(lv_obj_t* obj)
|
|||
DBG_ERR("DateTime component is not initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gDateTime.Day > sf_get_month_days(gDateTime.Year, gDateTime.Mon))
|
||||
{
|
||||
gDateTime.Day = sf_get_month_days(gDateTime.Year, gDateTime.Mon);
|
||||
}
|
||||
// UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
snprintf(DateTimeMOBuf, 3, "%02d", gDateTime.Mon);
|
||||
snprintf(DateTimeDDBuf, 3, "%02d", gDateTime.Day);
|
||||
|
@ -1242,10 +1274,10 @@ void Option_DateTime_Key(lv_obj_t* obj, uint32_t key)
|
|||
}
|
||||
else if(DateTimeIndex == 2)
|
||||
{
|
||||
if(gDateTime.Day > 1 && gDateTime.Day <= 31)
|
||||
if(gDateTime.Day > 1 && gDateTime.Day <= sf_get_month_days(gDateTime.Year, gDateTime.Mon))
|
||||
gDateTime.Day--;
|
||||
else
|
||||
gDateTime.Day = 31;
|
||||
gDateTime.Day = sf_get_month_days(gDateTime.Year, gDateTime.Mon);
|
||||
}
|
||||
else if(DateTimeIndex == 4)
|
||||
{
|
||||
|
@ -1287,7 +1319,7 @@ void Option_DateTime_Key(lv_obj_t* obj, uint32_t key)
|
|||
}
|
||||
else if(DateTimeIndex == 2)
|
||||
{
|
||||
if(gDateTime.Day >= 31)
|
||||
if(gDateTime.Day >= sf_get_month_days(gDateTime.Year, gDateTime.Mon))
|
||||
gDateTime.Day = 1;
|
||||
else
|
||||
gDateTime.Day++;
|
||||
|
@ -1360,10 +1392,10 @@ void Option_DateTime_Key_Long_Press(lv_obj_t* obj, uint32_t key)
|
|||
}
|
||||
else if(DateTimeIndex == 2)
|
||||
{
|
||||
if(gDateTime.Day > 0 && gDateTime.Day <= 31)
|
||||
if(gDateTime.Day > 0 && gDateTime.Day <= sf_get_month_days(gDateTime.Year, gDateTime.Mon))
|
||||
gDateTime.Day--;
|
||||
else
|
||||
gDateTime.Day = 31;
|
||||
gDateTime.Day = sf_get_month_days(gDateTime.Year, gDateTime.Mon);
|
||||
}
|
||||
else if(DateTimeIndex == 4)
|
||||
{
|
||||
|
@ -1405,7 +1437,7 @@ void Option_DateTime_Key_Long_Press(lv_obj_t* obj, uint32_t key)
|
|||
}
|
||||
else if(DateTimeIndex == 2)
|
||||
{
|
||||
if(gDateTime.Day >= 31)
|
||||
if(gDateTime.Day >= sf_get_month_days(gDateTime.Year, gDateTime.Mon))
|
||||
gDateTime.Day = 0;
|
||||
else
|
||||
gDateTime.Day++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user