Skip to content

Commit

Permalink
Merge pull request #5531 from bcgov/dev-marshal-SS-FOIMOD-3641
Browse files Browse the repository at this point in the history
FOIMOD 3641 - Fixed closedate issue
  • Loading branch information
JieunSon96 authored Jan 16, 2025
2 parents 426c0ff + 77c9b39 commit 32619f9
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import './confirmationmodal.scss';
import { StateEnum, StateTransitionCategories } from '../../../../constants/FOI/statusEnum';
import FileUpload from '../FileUpload'
import MinistryApprovalModal from './MinistryApprovalModal';
import { formatDate, calculateDaysRemaining, ConditionalComponent, isMinistryLogin } from "../../../../helper/FOI/helper";
import { formatDate, formatDateInPst, calculateDaysRemaining, ConditionalComponent, isMinistryLogin } from "../../../../helper/FOI/helper";
import { MimeTypeList, MaxFileSizeInMB, MaxNumberOfFiles } from "../../../../constants/FOI/enum";
import { getMessage, getAssignedTo, getMinistryGroup, getSelectedMinistry, getSelectedMinistryAssignedTo, getProcessingTeams, getUpdatedAssignedTo } from './util';

Expand Down Expand Up @@ -352,18 +352,21 @@ const CloseForm = React.memo(({saveRequestObject, handleClosingDateChange, handl
const _requestDetails = saveRequestObject;
const _closingReasons = useSelector(state=> state.foiRequests.closingReasons);

const today = new Date();
const [closingDateText, setClosingDate] = React.useState( formatDate(today) );
const today = formatDateInPst(new Date());
const [closingDateText, setClosingDate] = React.useState(today);
const [selectedReason, setClosingReason] = React.useState( 0 );

//############### replace this with the last status change date
const lastStatusChangeDate = _requestDetails.lastStatusUpdateDate;

React.useEffect(() => {
handleClosingDateChange(today);
}, []);

const _handleClosingDateChange = (e) => {
let pickedDate = e.target.value;
if(new Date(pickedDate) > today)
pickedDate = formatDate(today);

pickedDate = formatDateInPst(today);
setClosingDate(pickedDate);
handleClosingDateChange(pickedDate);
}
Expand Down Expand Up @@ -423,7 +426,7 @@ const CloseForm = React.memo(({saveRequestObject, handleClosingDateChange, handl
InputLabelProps={{
shrink: true,
}}
InputProps={{inputProps: { min: _requestDetails.requestProcessStart, max: formatDate(today)} }}
InputProps={{inputProps: { min: _requestDetails.requestProcessStart, max: formatDateInPst(today)} }}
variant="outlined"
required
error={closingDateText === undefined || closingDateText === ""}
Expand Down

0 comments on commit 32619f9

Please sign in to comment.