Skip to content

Commit

Permalink
Merge pull request #612 from mahajanmahesh935/profilepage
Browse files Browse the repository at this point in the history
TASK :#0000 Resolved event is live still showing ended message.please check and Unable to send more than 700 char
  • Loading branch information
paritshivani authored Sep 13, 2024
2 parents cc3e157 + 28a6de8 commit 5628b56
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
10 changes: 9 additions & 1 deletion packages/nulp_elite/src/pages/connections/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ const Chat = ({
const [toasterOpen, setToasterOpen] = useState(false);
const [toasterMessage, setToasterMessage] = useState("");
const [receiverData, setReceiverData] = useState([]);
const [eneteredtextValue, setEnteredTextValue] = useState("");
const charLimit = 700;
const [prefilledMessage, setPrefilledMessage] = useState(
"Hello! I’d like to connect with you."
);
Expand Down Expand Up @@ -520,6 +522,10 @@ const Chat = ({
const handleTextareaChange = (event) => {
setPrefilledMessage(event.target.value);
setTextValue(event.target.value);
const value = event.target.value;
if (value.length <= charLimit) {
setEnteredTextValue(value);
}
};
const onEmojiClick = (event, emojiObject) => {
const { emoji } = event;
Expand Down Expand Up @@ -849,7 +855,9 @@ const Chat = ({
fullWidth
sx={{ fontSize: "13px" }}
/>

<Box mt={1} textAlign="right" sx={{ fontSize: "12px", color: "#484848" ,marginTop: "0px",backgroundColor:"#ffffff", padding: "25px"}}>
{`${textValue.length}/${charLimit}`}
</Box>
<Button
style={{ color: "#484848" }}
onClick={sendMessage}
Expand Down
48 changes: 30 additions & 18 deletions packages/nulp_elite/src/pages/events/eventDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,29 +239,45 @@ const EventDetails = () => {
}, [eventId]);

const checkIfExpired = (registrationEndDate, endTime) => {
const regEndDate = new Date(registrationEndDate);
const regEndDateTime = new Date(registrationEndDate);
const regEndDate = new Date(registrationEndDate);
regEndDate.setHours(0, 0, 0, 0);

const currentDateTime = new Date();
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0);

console.log(regEndDate.toDateString(), "regEndDate");
console.log(currentDate.toDateString(), "currentDate");

if (currentDate > regEndDate) {
return true;
}

if (currentDate.toDateString() === regEndDate.toDateString()) {
const [timePart] = endTime.split("+");
const [endHours, endMinutes, endSeconds] = timePart.split(":").map(Number);

const endDateTime = new Date(
currentDate.toDateString() + " " + endTime.split("+")[0]
);
if (currentDateTime.toDateString() === regEndDateTime.toDateString()) {
if (formatTimeWithTimezone(currentDateTime) > endTime) {
return true;
}

console.log(endDateTime,"endDateTime--------");
console.log(regEndDate, "endDateTime with time");

if (currentDate > endDateTime) {
return true;
}
}

return false;
return false;
};

const formatTimeWithTimezone = (date) => {
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");

const timezoneOffset = date.getTimezoneOffset(); // in minutes
const absOffset = Math.abs(timezoneOffset);
const offsetHours = String(Math.floor(absOffset / 60)).padStart(2, "0");
const offsetMinutes = String(absOffset % 60).padStart(2, "0");
const sign = timezoneOffset <= 0 ? "+" : "-"; // If negative, it's ahead of UTC, so use "+"

return `${hours}:${minutes}:${seconds}${sign}${offsetHours}:${offsetMinutes}`;
};


Expand Down Expand Up @@ -802,11 +818,7 @@ const checkIfExpired = (registrationEndDate, endTime) => {
<Box className="d-flex alignItems-center pl-20">
<Box className="event-text-circle"></Box>
<Box className="h5-title">
{creatorInfo.firstName
? creatorInfo.firstName
: "" + " " + creatorInfo.lastName
? creatorInfo.lastName
: ""}
{detailData.eventOrganisedby}
</Box>
</Box>
</Box>
Expand Down

0 comments on commit 5628b56

Please sign in to comment.