Skip to content

Commit

Permalink
Merge pull request #94 from amansinghbais/facilities/#90
Browse files Browse the repository at this point in the history
Improved: code to display closed if not day time given and start time in 12 hrs format (#90)
  • Loading branch information
ravilodhi authored Dec 11, 2023
2 parents 5c58d5a + a926518 commit b1a4ec3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 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: 3 additions & 1 deletion src/views/FacilityDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@
<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

0 comments on commit b1a4ec3

Please sign in to comment.