tripstorekrabi-shared 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/booking.js +33 -0
  2. package/package.json +1 -1
package/booking.js CHANGED
@@ -115,4 +115,37 @@ export function addBookingFromInvoice(firestore, admin, invoice, paymentData, co
115
115
  );
116
116
  });
117
117
  });
118
+ }
119
+
120
+ export function getStartingPointMessage(booking) {
121
+ let text = booking.startingPointDescription;
122
+ if (booking.pickupTime.indexOf('-') != -1) {
123
+ text +=
124
+ ' between ' +
125
+ booking.pickupTime.replace(' - ', ' and ').replace('-', ' and ');
126
+ } else {
127
+ text += ' at ' + booking.pickupTime;
128
+ }
129
+
130
+ let date = dayjs(booking.departureDate.toDate()).format('Do MMM');
131
+
132
+ if (
133
+ dayjs().add(1, 'day').isSame(dayjs(booking.departureDate.toDate()), 'day')
134
+ ) {
135
+ text += ' tomorrow the ' + date;
136
+ } else if (dayjs().isSame(dayjs(booking.departureDate.toDate()), 'day')) {
137
+ text += ' today the ' + date;
138
+ } else {
139
+ text += ' on the ' + date;
140
+ }
141
+
142
+ text += '. Please watch out for the staff of ' + booking.operator + '.';
143
+
144
+ if (booking.specialRequirements) {
145
+ text +=
146
+ '\n\nSPECIAL REQUIREMENTS: ' +
147
+ booking.specialRequirements.toUpperCase();
148
+ }
149
+
150
+ return text;
118
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {