I am building a parking management app in node-js and utilizing MongoDB as a database.
So first let's understand what my concern is:
- The first thing is that, Merchant or the person who has open-plot or any available space for parking will rent (add to app's database) his space to other people at whatever rate that he has decided to. The merchant will not add the parking availability every day.
He will add parking availability data at once(If S/he wants to add data on daily basis then no problem whatsoever but this is my perspective) like this From Mon-Fri the timing for parking availability is 9:00 to 18:00, on saturday it will be 9:00 to 14:00 and on sunday it is unavailable. The thing to note here is that he will not add by DATE
- Now, The user who wants to book that available parking space will search it by city/state/area and most importantly DATE. User will not search by Day.
So, my question is, Is there any method to convert that day into date and user can easily find it? Is using day.js library makes it easier?
Availability schema from parkings table:
availability: [
{
day: {
type: String,
},
startTime: {
type: Date,
},
endTime: {
type: String,
},
},
],