ordering-ui-react-native 0.15.48 → 0.15.49
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.
package/package.json
CHANGED
|
@@ -102,12 +102,13 @@ export const PreviousOrders = (props: any) => {
|
|
|
102
102
|
const getDelayMinutes = (order: any) => {
|
|
103
103
|
// targetMin = delivery_datetime + eta_time - now()
|
|
104
104
|
const offset = 300
|
|
105
|
-
const cdtToutc =
|
|
105
|
+
const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
|
|
106
106
|
const _delivery = order?.delivery_datetime_utc
|
|
107
107
|
? parseDate(order?.delivery_datetime_utc)
|
|
108
108
|
: parseDate(cdtToutc)
|
|
109
109
|
const _eta = order?.eta_time
|
|
110
|
-
|
|
110
|
+
const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
|
|
111
|
+
return Math.ceil(diffTimeAsSeconds / 60)
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
const displayDelayedTime = (order: any) => {
|
|
@@ -128,9 +129,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
128
129
|
return finalTaget
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
const getStatusClassName = (minutes:
|
|
132
|
-
if (isNaN(Number(minutes))) return
|
|
133
|
-
|
|
132
|
+
const getStatusClassName = (minutes: number) => {
|
|
133
|
+
if (isNaN(Number(minutes))) return 'in_time'
|
|
134
|
+
const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
|
|
135
|
+
return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
useEffect(() => {
|