Skip to content
This repository was archived by the owner on Aug 17, 2024. It is now read-only.

Conversation

@khmdagal
Copy link

master

Copy link

@Ara225 Ara225 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had to flag quite a few thing this time. Don't be discouraged, I'm sure you'll figure it all out, you're a strong student in the end of the day. Only genral note is to have a look into .gitignore files, as you've accidently commited the node_modules folder and that is considered bad practice. See https://www.freecodecamp.org/news/gitignore-what-is-it-and-how-to-add-to-repo/ and https://github.com/github/gitignore

bookings.push(newBooking);
res.status(200).send(bookings);
} else {
res.status(400).send("Some information is missing");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

//Level 3 search by date

// convet date to numbers
const dateToNumber = (date) => Number(date.replaceAll("-", ""));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intresting idea, and as the date format they ask you to use is non standard (normally years are last e.g. 27/01/2023) should work alright, but this isn't the correct way to do it. You'd want to make both dates into a date object wether the native JavaScript date object or a moment.js one, and then compare it

// level 4

const emailValidation = (email) => {
email.includes("@") ? email : "Not valid email";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lot more to email validation than this I'm afraid, worth reading up/using a libary. Also, it would be best to return a boolean from this function. At the moment, this function always returns a non empty string so it will always evaluate to true.

// only checking when the checkOutDate is earlier then the checkIndate
if (checkOutDate < checkInDate) {
return "!! checkOutDate can not be earlier then the CheckInDate";
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this logic is flawed I'm afraid, The result of this function will be a value that JavaScript considers True if checkOutDate is earlier than CheckInDate and undefined otherwise . Date comparsion in this way is also flawed, have a look at the Date object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants