Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK :#0000 Resolved event is live still showing ended message.please check and Unable to send more than 700 char #612

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading