Commit 9de240bd authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

comctl32/datetime: Don't allow an invalid year to be typed in.

parent 3f932308
......@@ -847,6 +847,7 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr)
int fieldNum = infoPtr->select & DTHT_DATEFIELD;
int i, val=0, clamp_day=0;
SYSTEMTIME date = infoPtr->date;
int oldyear;
if (infoPtr->select == -1 || infoPtr->nCharsEntered == 0)
return;
......@@ -859,13 +860,25 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr)
switch (infoPtr->fieldspec[fieldNum]) {
case ONEDIGITYEAR:
case TWODIGITYEAR:
oldyear = date.wYear;
date.wYear = date.wYear - (date.wYear%100) + val;
if (DATETIME_IsDateInValidRange(infoPtr, &date))
clamp_day = 1;
else
date.wYear = oldyear;
break;
case INVALIDFULLYEAR:
case FULLYEAR:
oldyear = date.wYear;
date.wYear = val;
if (DATETIME_IsDateInValidRange(infoPtr, &date))
clamp_day = 1;
else
date.wYear = oldyear;
break;
case ONEDIGITMONTH:
case TWODIGITMONTH:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment