Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
2.7 kB
2
Indexable
          {UiUtils.determineMPFTermination("initialTerminationNote", Number(props.productTypeNmbr)) &&
              <Modal openOnLoad={true}
                title={t("common.impNotice")}
                textLine1={t("mpfClosure.mpfClosureNote4")}
                textLine2={t("mpfClosure.mpfClosureNote2")}
                textLine3={t("mpfClosure.mpfClosureNote3")}
                redirect={"/dashboard"}
              />

const initialTerminationNote = moment(process.env.REACT_APP_MPF_TERMINATION_INITIAL_NOTE, DD_MM_YYYY_HH_mm_ss, true);
const determineMPFTermination = (phase, productTypeNmbr = 0) => {
    let isMPFTerminated = false;
    const currentDateHk = new Date();
    const hkTimeString = currentDateHk.toLocaleString(enGB, { timeZone: asiaHongKong });
    const hkTime = moment(hkTimeString, DD_MM_YYYY_HH_mm_ss, true);
    //   eslint-disable-next-line no-undef
    const mpfTerminationDatePhase0 = moment(process.env.REACT_APP_MPF_TERMINATION_DATE_PHASE_0, DD_MM_YYYY_HH_mm_ss, true);
    //   eslint-disable-next-line no-undef
    const mpfTerminationDatePhase2 = moment(process.env.REACT_APP_MPF_TERMINATION_DATE_PHASE_2, DD_MM_YYYY_HH_mm_ss, true);
    //   eslint-disable-next-line no-undef
    const fundSwitchCutOffDate = moment(process.env.REACT_APP_MPF_TERMINATION_FUND_SWITCHING, DD_MM_YYYY_HH_mm_ss, true);
    //   eslint-disable-next-line no-undef
    const profileInfoCutOffDate = moment(process.env.REACT_APP_MPF_TERMINATION_PROFILE_UPDATE, DD_MM_YYYY_HH_mm_ss, true);
    //   eslint-disable-next-line no-undef
    const initialTerminationNote = moment(process.env.REACT_APP_MPF_TERMINATION_INITIAL_NOTE, DD_MM_YYYY_HH_mm_ss, true);
    
    if (phase == 0) {
        isMPFTerminated = hkTime.toDate() > mpfTerminationDatePhase0?.toDate();
    } else if (phase == 2) {
        isMPFTerminated = hkTime.toDate() > mpfTerminationDatePhase2?.toDate();
    } else if (phase == "fundSwitchCutOff") {
        isMPFTerminated = (hkTime.toDate() > fundSwitchCutOffDate?.toDate() && hkTime.toDate() < mpfTerminationDatePhase2?.toDate());
    } else if (phase == "profileInfoCutOff") {
        isMPFTerminated = (hkTime.toDate() > profileInfoCutOffDate?.toDate() && hkTime.toDate() < mpfTerminationDatePhase2?.toDate());
    } else if (phase == "initialTerminationNote") {
        isMPFTerminated = (hkTime.toDate() > initialTerminationNote?.toDate() && hkTime.toDate() < mpfTerminationDatePhase2?.toDate());
    }
    return productTypeNmbr == 0 ? isMPFTerminated : (isMPFTerminated && productTypeNumbersMPF.includes(productTypeNmbr));
};

"REACT_APP_MPF_TERMINATION_INITIAL_NOTE": "06/07/2024, 00:00:00",
Leave a Comment