Skip to content

Commit

Permalink
Improved: code to display closed if not day time given and start time…
Browse files Browse the repository at this point in the history
… in 12 hrs format(#90)
  • Loading branch information
amansinghbais committed Dec 11, 2023
1 parent 318ef27 commit 32b7ec6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/components/AddOperatingHoursModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
<div class="ion-padding" slot="content">
<ion-list lines="none">
<ion-item v-for="day in days" :key="day">
<p>{{ translate(day.charAt(0).toUpperCase() + day.slice(1)) }}</p>
<ion-label slot="end">{{ calendar[day+'StartTime'] ? getStartAndEndTime(calendar[day+'StartTime'], calendar[day+'Capacity']) : '-' }} </ion-label>
<ion-label>
<p>{{ translate(day.charAt(0).toUpperCase() + day.slice(1)) }}</p>
</ion-label>
<ion-label slot="end">
<p>{{ calendar[day+'StartTime'] ? getStartAndEndTime(calendar[day+'StartTime'], calendar[day+'Capacity']) : translate('Closed') }}</p>
</ion-label>
</ion-item>
</ion-list>
</div>
Expand Down Expand Up @@ -173,7 +177,7 @@ export default defineComponent({
modalController.dismiss()
},
getStartAndEndTime(startTime: any, capacity: any) {
const formatedStartTime = DateTime.fromFormat(startTime, 'HH:mm:ss').toFormat('HH:mm a');
const formatedStartTime = DateTime.fromFormat(startTime, 'HH:mm:ss').toFormat('hh:mm a');
const endTime = DateTime.fromMillis(DateTime.fromFormat(startTime, 'HH:mm:ss').toMillis() + capacity).toFormat('hh:mm a')
return `${formatedStartTime} - ${endTime}`
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Choose language": "Choose language",
"City": "City",
"Click the backdrop to dismiss.": "Click the backdrop to dismiss.",
"Closed": "Closed",
"Closing Time": "Closing Time",
"Configure settings later": "Configure settings later",
"Configure the order fulfillment capacity of your facility.": "Configure the order fulfillment capacity of your facility.",
Expand Down
4 changes: 2 additions & 2 deletions src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<ion-label>
<p>{{ translate(day.charAt(0).toUpperCase() + day.slice(1)) }}</p>
</ion-label>
<ion-label slot="end">{{ facilityCalendar[day+'StartTime'] ? getOpenEndTime(facilityCalendar[day+'StartTime'], facilityCalendar[day+'Capacity']) : '-' }} </ion-label>
<ion-label slot="end"><p>{{ facilityCalendar[day+'StartTime'] ? getOpenEndTime(facilityCalendar[day+'StartTime'], facilityCalendar[day+'Capacity']) : translate('Closed') }}</p></ion-label>
</ion-item>
</ion-list>
</ion-card>
Expand Down Expand Up @@ -572,7 +572,7 @@ export default defineComponent({
componentProps: { facilityId: this.facilityId }
})
addressModal.present()
addressModal.present()
},
async addCustomSchedule() {
const customScheduleModal = await modalController.create({
Expand Down

0 comments on commit 32b7ec6

Please sign in to comment.