Web: People: fixed profile dates
This commit is contained in:
parent
356e00ceed
commit
2e000f1d9d
@ -146,7 +146,6 @@ class Calendar extends Component {
|
||||
|
||||
const openToDateYear = openToDate.getFullYear();
|
||||
|
||||
let disabled = false;
|
||||
const listMonths = [];
|
||||
|
||||
let i = 0;
|
||||
@ -154,12 +153,12 @@ class Calendar extends Component {
|
||||
listMonths.push({
|
||||
key: `${i}`,
|
||||
label: `${months[i]}`,
|
||||
disabled: disabled,
|
||||
disabled: false,
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
||||
if (openToDateYear <= minDateYear) {
|
||||
if (openToDateYear < minDateYear) {
|
||||
i = 0;
|
||||
while (i != 12) {
|
||||
if (i != minDateMonth) listMonths[i].disabled = true;
|
||||
@ -173,7 +172,9 @@ class Calendar extends Component {
|
||||
listMonths[i].disabled = true;
|
||||
i++;
|
||||
}
|
||||
} else if (openToDateYear === maxDateYear) {
|
||||
}
|
||||
|
||||
if (openToDateYear === maxDateYear) {
|
||||
i = 11;
|
||||
while (i != maxDateMonth) {
|
||||
listMonths[i].disabled = true;
|
||||
|
@ -20,6 +20,7 @@ class DateField extends React.Component {
|
||||
inputOnChange,
|
||||
inputTabIndex,
|
||||
calendarMinDate,
|
||||
calendarMaxDate,
|
||||
locale,
|
||||
maxLabelWidth,
|
||||
} = this.props;
|
||||
@ -41,7 +42,7 @@ class DateField extends React.Component {
|
||||
displayType="auto"
|
||||
calendarHeaderContent={calendarHeaderContent}
|
||||
minDate={calendarMinDate ? calendarMinDate : new Date("1900/01/01")}
|
||||
maxDate={new Date()}
|
||||
maxDate={calendarMaxDate ? calendarMaxDate : new Date()}
|
||||
locale={locale}
|
||||
/>
|
||||
</FieldContainer>
|
||||
|
@ -249,7 +249,13 @@ class UpdateUserForm extends React.Component {
|
||||
|
||||
onBirthdayDateChange = (value) => {
|
||||
var stateCopy = Object.assign({}, this.state);
|
||||
stateCopy.profile.birthday = value ? value.toJSON() : null;
|
||||
const birthday = value ? value.toJSON() : stateCopy.profile.workFrom;
|
||||
stateCopy.profile.birthday = birthday;
|
||||
|
||||
if (new Date(birthday) > new Date(stateCopy.profile.workFrom)) {
|
||||
stateCopy.profile.workFrom = birthday;
|
||||
}
|
||||
|
||||
this.setState(stateCopy);
|
||||
this.setIsEdit();
|
||||
};
|
||||
@ -705,9 +711,6 @@ class UpdateUserForm extends React.Component {
|
||||
? new Date(profile.birthday)
|
||||
: new Date(this.props.profile.workFrom);
|
||||
|
||||
const workFromDateValue =
|
||||
calendarWorkFrom <= calendarMinDate ? calendarMinDate : calendarWorkFrom;
|
||||
|
||||
return (
|
||||
<>
|
||||
<MainContainer>
|
||||
@ -881,7 +884,7 @@ class UpdateUserForm extends React.Component {
|
||||
calendarHeaderContent={`${t("CalendarSelectDate")}:`}
|
||||
labelText={`${regDateCaption}:`}
|
||||
inputName="workFrom"
|
||||
inputValue={workFromDateValue}
|
||||
inputValue={calendarWorkFrom}
|
||||
inputIsDisabled={
|
||||
isLoading ||
|
||||
!isAdmin ||
|
||||
@ -892,6 +895,7 @@ class UpdateUserForm extends React.Component {
|
||||
calendarMinDate={calendarMinDate}
|
||||
locale={language}
|
||||
maxLabelWidth={maxLabelWidth}
|
||||
//calendarMaxDate={calendarMinDate}
|
||||
/>
|
||||
)}
|
||||
<TextField
|
||||
|
Loading…
Reference in New Issue
Block a user