@things-factory/operato-wms 4.3.708 → 4.3.725

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.
@@ -28,6 +28,13 @@ const HEADER_JSON = {
28
28
  Accept: 'application/json'
29
29
  }
30
30
 
31
+ function formatLocalDate(date = new Date()) {
32
+ const year = date.getFullYear()
33
+ const month = String(date.getMonth() + 1).padStart(2, '0')
34
+ const day = String(date.getDate()).padStart(2, '0')
35
+ return `${year}-${month}-${day}`
36
+ }
37
+
31
38
  class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
32
39
  static get styles() {
33
40
  return [
@@ -124,16 +131,29 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
124
131
  let { params } = lifecycle
125
132
  if (params && this._searchFields) {
126
133
  if (params.range) {
127
- params.toDate = new Date().toISOString().split('T')[0]
134
+ const today = new Date()
135
+ params.toDate = formatLocalDate(today)
128
136
  switch (params.range) {
129
137
  case '1d':
130
- params.fromDate = new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split('T')[0]
138
+ {
139
+ const from = new Date()
140
+ from.setDate(from.getDate() - 1)
141
+ params.fromDate = formatLocalDate(from)
142
+ }
131
143
  break
132
144
  case '1w':
133
- params.fromDate = new Date(new Date().setDate(new Date().getDate() - 7)).toISOString().split('T')[0]
145
+ {
146
+ const from = new Date()
147
+ from.setDate(from.getDate() - 7)
148
+ params.fromDate = formatLocalDate(from)
149
+ }
134
150
  break
135
151
  case '1m':
136
- params.fromDate = new Date(new Date().setMonth(new Date().getMonth() - 1)).toISOString().split('T')[0]
152
+ {
153
+ const from = new Date()
154
+ from.setMonth(from.getMonth() - 1)
155
+ params.fromDate = formatLocalDate(from)
156
+ }
137
157
  break
138
158
  default:
139
159
  break
@@ -207,7 +227,7 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
207
227
  value: (() => {
208
228
  let date = new Date()
209
229
  date.setMonth(date.getMonth() - 1)
210
- return date.toISOString().split('T')[0]
230
+ return formatLocalDate(date)
211
231
  })(),
212
232
  handlers: { change: this._modifyDateRange.bind(this) }
213
233
  },
@@ -220,15 +240,15 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
220
240
  min: (() => {
221
241
  let date = new Date()
222
242
  date.setMonth(date.getMonth() - 1)
223
- return date.toISOString().split('T')[0]
243
+ return formatLocalDate(date)
224
244
  })(),
225
245
  max: (() => {
226
246
  let date = new Date()
227
247
  date.setDate(date.getDate())
228
- return date.toISOString().split('T')[0]
248
+ return formatLocalDate(date)
229
249
  })()
230
250
  },
231
- value: new Date().toISOString().split('T')[0]
251
+ value: formatLocalDate(new Date())
232
252
  },
233
253
  {
234
254
  label: i18next.t('field.transporter'),
@@ -981,14 +1001,11 @@ class B2cOrderRequests extends connect(store)(localize(i18next)(PageView)) {
981
1001
  if (this._toDateInput?.value < fromDate) this._toDateInput.value = fromDate
982
1002
 
983
1003
  let min = new Date(fromDate)
984
- let today = new Date()
985
1004
  let oneMonthRange = new Date(fromDate)
986
1005
  oneMonthRange.setMonth(oneMonthRange.getMonth() + 1)
987
- oneMonthRange = oneMonthRange.toISOString().split('T')[0]
988
-
989
- today.setHours(0, 0, 0, 0)
1006
+ oneMonthRange = formatLocalDate(oneMonthRange)
990
1007
 
991
- min = min.toISOString().split('T')[0]
1008
+ min = formatLocalDate(min)
992
1009
 
993
1010
  this._toDateInput.min = min
994
1011
  this._toDateInput.value = oneMonthRange
@@ -2,24 +2,20 @@ import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
 
4
4
  import gql from 'graphql-tag'
5
- import {
6
- css,
7
- html
8
- } from 'lit-element'
5
+ import { css, html } from 'lit-element'
9
6
  import { connect } from 'pwa-helpers/connect-mixin'
10
7
 
11
- import {
12
- i18next,
13
- localize
14
- } from '@things-factory/i18n-base'
15
- import {
16
- client,
17
- gqlContext,
18
- PageView,
19
- store
20
- } from '@things-factory/shell'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, gqlContext, PageView, store } from '@things-factory/shell'
21
10
  import { isMobileDevice } from '@things-factory/utils'
22
11
 
12
+ function formatLocalDate(date = new Date()) {
13
+ const year = date.getFullYear()
14
+ const month = String(date.getMonth() + 1).padStart(2, '0')
15
+ const day = String(date.getDate()).padStart(2, '0')
16
+ return `${year}-${month}-${day}`
17
+ }
18
+
23
19
  class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(PageView)) {
24
20
  static get styles() {
25
21
  return css`
@@ -123,12 +119,12 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
123
119
  type: 'date',
124
120
  props: {
125
121
  searchOper: 'eq',
126
- max: new Date().toISOString().split('T')[0]
122
+ max: formatLocalDate(new Date())
127
123
  },
128
124
  value: (() => {
129
- let date = new Date()
125
+ const date = new Date()
130
126
  date.setMonth(date.getMonth() - 1)
131
- return date.toISOString().split('T')[0]
127
+ return formatLocalDate(date)
132
128
  })(),
133
129
  handlers: { change: this._modifyDateRange.bind(this) }
134
130
  },
@@ -139,13 +135,13 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
139
135
  props: {
140
136
  searchOper: 'eq',
141
137
  min: (() => {
142
- let date = new Date()
138
+ const date = new Date()
143
139
  date.setMonth(date.getMonth() - 1)
144
- return date.toISOString().split('T')[0]
140
+ return formatLocalDate(date)
145
141
  })(),
146
- max: new Date().toISOString().split('T')[0]
142
+ max: formatLocalDate(new Date())
147
143
  },
148
- value: new Date().toISOString().split('T')[0],
144
+ value: formatLocalDate(new Date()),
149
145
  handlers: { change: this._submit.bind(this) }
150
146
  },
151
147
  {
@@ -322,8 +318,8 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
322
318
  const data = {
323
319
  total: response.data.analysisPickingPackingReport.total,
324
320
  records:
325
- response.data.analysisPickingPackingReport.items.map(i=> {
326
- let hourlyData = JSON.parse(i.hourlyData)
321
+ response.data.analysisPickingPackingReport.items.map(i => {
322
+ let hourlyData = JSON.parse(i.hourlyData)
327
323
  return {
328
324
  ...i,
329
325
  ...hourlyData
@@ -339,7 +335,6 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
339
335
  } catch (e) {
340
336
  this._showToast(e)
341
337
  }
342
-
343
338
  }
344
339
 
345
340
  async _fetchPartners() {
@@ -396,7 +391,10 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
396
391
 
397
392
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
398
393
 
399
- let min = new Date(fromDate).toISOString().split('T')[0]
394
+ const minDate = new Date(fromDate)
395
+ if (Number.isNaN(minDate.getTime())) return
396
+
397
+ const min = formatLocalDate(minDate)
400
398
  this._toDateInput.min = min
401
399
  this._submit()
402
400
  }
@@ -408,72 +406,71 @@ class AnalysisPickingPackingReport extends connect(store)(localize(i18next)(Page
408
406
 
409
407
  async _exportableData() {
410
408
  try {
411
- const getTimeRangeHeader = hour => {
412
- const now = new Date();
413
- now.setHours(hour);
414
- const next = new Date(now);
415
- next.setHours(now.getHours() + 1);
416
- return `${now.toLocaleString('en-US', { hour: 'numeric', hour12: true })} - ${next.toLocaleString('en-US', {
417
- hour: 'numeric',
418
- hour12: true
419
- })}`;
420
- };
421
-
422
- const timeRangeColumns = Array.from({ length: 12 }, (_, i) => {
423
- const startHour = i + 7;
424
- const header = getTimeRangeHeader(startHour);
425
- const key = `${startHour}`;
409
+ const getTimeRangeHeader = hour => {
410
+ const now = new Date()
411
+ now.setHours(hour)
412
+ const next = new Date(now)
413
+ next.setHours(now.getHours() + 1)
414
+ return `${now.toLocaleString('en-US', { hour: 'numeric', hour12: true })} - ${next.toLocaleString('en-US', {
415
+ hour: 'numeric',
416
+ hour12: true
417
+ })}`
418
+ }
419
+
420
+ const timeRangeColumns = Array.from({ length: 12 }, (_, i) => {
421
+ const startHour = i + 7
422
+ const header = getTimeRangeHeader(startHour)
423
+ const key = `${startHour}`
424
+ return {
425
+ type: 'number',
426
+ name: `${startHour}`,
427
+ header: header,
428
+ key: key,
429
+ record: { editable: false, align: 'center' },
430
+ width: 20
431
+ }
432
+ })
433
+
434
+ const headerSetting = [
435
+ { header: i18next.t('field.name'), key: 'name', width: 30, type: 'string' },
436
+ ...timeRangeColumns,
437
+ { header: i18next.t('field.total_days_worked'), key: 'totalDaysWorked', width: 30, type: 'float' },
438
+ { header: i18next.t('field.total_pack'), key: 'totalPacks', width: 30, type: 'float' },
439
+ { header: i18next.t('field.total_hours_worked'), key: 'totalHoursWorked', width: 30, type: 'float' },
440
+ { header: i18next.t('field.packing_rate'), key: 'packingRate', width: 30, type: 'float' }
441
+ ]
442
+
443
+ let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
444
+ const hourlyData = JSON.parse(itm.hourlyData) // Parse the hourly data from JSON
445
+ const timeRangeData = Array.from({ length: 12 }, (_, i) => {
446
+ const startHour = i + 7
447
+ const key = `${startHour}`
448
+ const value = parseFloat(hourlyData[startHour.toString()]) || 0 // Convert to number
426
449
  return {
427
- type: 'number',
428
- name: `${startHour}`,
429
- header: header,
430
- key: key,
431
- record: { editable: false, align: 'center' },
432
- width: 20
433
- };
434
- });
435
-
436
- const headerSetting = [
437
- { header: i18next.t('field.name'), key: 'name', width: 30, type: 'string' },
438
- ...timeRangeColumns,
439
- { header: i18next.t('field.total_days_worked'), key: 'totalDaysWorked', width: 30, type: 'float' },
440
- { header: i18next.t('field.total_pack'), key: 'totalPacks', width: 30, type: 'float' },
441
- { header: i18next.t('field.total_hours_worked'), key: 'totalHoursWorked', width: 30, type: 'float' },
442
- { header: i18next.t('field.packing_rate'), key: 'packingRate', width: 30, type: 'float' }
443
- ];
444
-
445
- let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records.map(itm => {
446
- const hourlyData = JSON.parse(itm.hourlyData); // Parse the hourly data from JSON
447
- const timeRangeData = Array.from({ length: 12 }, (_, i) => {
448
- const startHour = i + 7;
449
- const key = `${startHour}`;
450
- const value = parseFloat(hourlyData[startHour.toString()]) || 0; // Convert to number
451
- return {
452
- [key]: value
453
- };
454
- }).reduce((obj, item) => ({ ...obj, ...item }), {});
450
+ [key]: value
451
+ }
452
+ }).reduce((obj, item) => ({ ...obj, ...item }), {})
455
453
 
456
454
  return {
457
- ...timeRangeData,
458
- name: itm.name,
455
+ ...timeRangeData,
456
+ name: itm.name,
459
457
  totalDaysWorked: itm.totalDaysWorked,
460
458
  totalPacks: itm.totalPacks,
461
459
  totalHoursWorked: itm.totalHoursWorked,
462
460
  packingRate: itm.packingRate
463
- };
464
- });
465
-
461
+ }
462
+ })
463
+
466
464
  var exportData = {
467
465
  header: [...headerSetting],
468
466
  data
469
- };
470
-
471
- return exportData;
472
-
467
+ }
468
+
469
+ return exportData
473
470
  } catch (e) {
474
- this._showToast(e);
471
+ this._showToast(e)
475
472
  }
476
- }
473
+ }
477
474
 
478
475
  _showToast({ type, message }) {
479
476
  document.dispatchEvent(
@@ -11,6 +11,13 @@ import { client, gqlContext, PageView, store } from '@things-factory/shell'
11
11
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
12
12
  import { LOCATION_TYPE } from '../constants/location'
13
13
 
14
+ function formatLocalDate(date = new Date()) {
15
+ const year = date.getFullYear()
16
+ const month = String(date.getMonth() + 1).padStart(2, '0')
17
+ const day = String(date.getDate()).padStart(2, '0')
18
+ return `${year}-${month}-${day}`
19
+ }
20
+
14
21
  class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
15
22
  static get styles() {
16
23
  return css`
@@ -120,12 +127,12 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
120
127
  type: 'date',
121
128
  props: {
122
129
  searchOper: 'eq',
123
- max: new Date().toISOString().split('T')[0]
130
+ max: formatLocalDate(new Date())
124
131
  },
125
132
  value: (() => {
126
- let date = new Date()
133
+ const date = new Date()
127
134
  date.setMonth(date.getMonth() - 1)
128
- return date.toISOString().split('T')[0]
135
+ return formatLocalDate(date)
129
136
  })(),
130
137
  handlers: { change: this._modifyDateRange.bind(this) }
131
138
  },
@@ -136,39 +143,35 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
136
143
  props: {
137
144
  searchOper: 'eq',
138
145
  min: (() => {
139
- let date = new Date()
146
+ const date = new Date()
140
147
  date.setMonth(date.getMonth() - 1)
141
- return date.toISOString().split('T')[0]
148
+ return formatLocalDate(date)
142
149
  })(),
143
- max: new Date().toISOString().split('T')[0]
150
+ max: formatLocalDate(new Date())
144
151
  },
145
- value: new Date().toISOString().split('T')[0]
152
+ value: formatLocalDate(new Date())
146
153
  },
147
154
  {
148
155
  label: i18next.t('field.location_type'),
149
156
  name: 'locationType',
150
157
  type: 'select',
151
- options: [
152
- {value: ''},
153
- ...Object.values(LOCATION_TYPE)
154
- ],
155
- props: { searchOper: 'eq'}
158
+ options: [{ value: '' }, ...Object.values(LOCATION_TYPE)],
159
+ props: { searchOper: 'eq' }
156
160
  }
157
161
  ]
158
162
  }
159
163
 
160
164
  get reportConfig() {
161
-
162
165
  this._gristData.records.forEach((record, i) => {
163
166
  console.log(`Record ${i}:`, Object.keys(record))
164
167
  })
165
-
168
+
166
169
  const dataKeys = this._gristData.records.reduce((keys, item) => {
167
170
  Object.keys(item).forEach(key => keys.add(key))
168
171
  return keys
169
172
  }, new Set())
170
173
 
171
- let columns = [
174
+ let columns = [
172
175
  { type: 'gutter', gutterName: 'sequence' },
173
176
  {
174
177
  type: 'string',
@@ -183,7 +186,7 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
183
186
  dataKeys.forEach(key => {
184
187
  if (!excludedKeys.has(key)) {
185
188
  columns.push({
186
- type: 'string',
189
+ type: 'string',
187
190
  name: key,
188
191
  header: key,
189
192
  width: 170,
@@ -193,15 +196,15 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
193
196
  })
194
197
 
195
198
  const filteredColumns = columns
196
- .filter(column => column.imex && dataKeys.has(column.imex.key))
197
- .sort((a, b) => {
198
- const aStartsWithTotal = a.header.toLowerCase().startsWith('total');
199
- const bStartsWithTotal = b.header.toLowerCase().startsWith('total');
200
-
201
- if (aStartsWithTotal && !bStartsWithTotal) return 1; // Move 'Total' headers down
202
- if (!aStartsWithTotal && bStartsWithTotal) return -1; // Keep non-'Total' headers first
203
- return 0;
204
- });
199
+ .filter(column => column.imex && dataKeys.has(column.imex.key))
200
+ .sort((a, b) => {
201
+ const aStartsWithTotal = a.header.toLowerCase().startsWith('total')
202
+ const bStartsWithTotal = b.header.toLowerCase().startsWith('total')
203
+
204
+ if (aStartsWithTotal && !bStartsWithTotal) return 1 // Move 'Total' headers down
205
+ if (!aStartsWithTotal && bStartsWithTotal) return -1 // Keep non-'Total' headers first
206
+ return 0
207
+ })
205
208
 
206
209
  return {
207
210
  columns: filteredColumns,
@@ -294,7 +297,6 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
294
297
  if (existingRecord) {
295
298
  existingRecord[propertyName] = itm.quantity
296
299
  } else {
297
-
298
300
  const propertyName = itm.packingType
299
301
 
300
302
  acc.push({
@@ -374,38 +376,33 @@ class BillingModuleReport extends connect(store)(localize(i18next)(PageView)) {
374
376
 
375
377
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
376
378
 
377
- let min = new Date(fromDate)
378
- let today = new Date()
379
- today.setHours(0, 0, 0, 0)
380
-
381
- min = min.toISOString().split('T')[0]
379
+ const minDate = new Date(fromDate)
380
+ if (Number.isNaN(minDate.getTime())) return
382
381
 
382
+ const min = formatLocalDate(minDate)
383
383
  this._toDateInput.min = min
384
384
  }
385
385
 
386
386
  async _exportableData() {
387
387
  try {
388
- let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records;
389
-
390
- let header = this.dataGrist._config.columns
391
- .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
392
- .map(column => {
393
- return {
394
- header: column.imex.header ?? column.imex.key, // Assign key if header is missing
395
- key: column.imex.key
396
- };
397
- });
398
-
399
- return { header, data };
388
+ let data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records
389
+
390
+ let header = this.dataGrist._config.columns
391
+ .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
392
+ .map(column => {
393
+ return {
394
+ header: column.imex.header ?? column.imex.key, // Assign key if header is missing
395
+ key: column.imex.key
396
+ }
397
+ })
398
+
399
+ return { header, data }
400
400
  } catch (e) {
401
- console.error("Export error:", e);
402
- this._showToast(e);
403
- }
401
+ console.error('Export error:', e)
402
+ this._showToast(e)
403
+ }
404
404
  }
405
405
 
406
-
407
-
408
-
409
406
  _showToast({ type, message }) {
410
407
  document.dispatchEvent(
411
408
  new CustomEvent('notify', {
@@ -11,6 +11,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
11
11
  import { client, gqlContext, PageView, store } from '@things-factory/shell'
12
12
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
13
13
 
14
+ function formatLocalDate(date = new Date()) {
15
+ const year = date.getFullYear()
16
+ const month = String(date.getMonth() + 1).padStart(2, '0')
17
+ const day = String(date.getDate()).padStart(2, '0')
18
+ return `${year}-${month}-${day}`
19
+ }
20
+
14
21
  class CostingReport extends connect(store)(localize(i18next)(PageView)) {
15
22
  static get styles() {
16
23
  return css`
@@ -107,12 +114,12 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
107
114
  type: 'date',
108
115
  props: {
109
116
  searchOper: 'eq',
110
- max: new Date().toISOString().split('T')[0]
117
+ max: formatLocalDate(new Date())
111
118
  },
112
119
  value: (() => {
113
- let date = new Date()
120
+ const date = new Date()
114
121
  date.setMonth(date.getMonth() - 1)
115
- return date.toISOString().split('T')[0]
122
+ return formatLocalDate(date)
116
123
  })(),
117
124
  handlers: { change: this._modifyDateRange.bind(this) }
118
125
  },
@@ -123,17 +130,17 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
123
130
  props: {
124
131
  searchOper: 'eq',
125
132
  min: (() => {
126
- let date = new Date()
133
+ const date = new Date()
127
134
  date.setMonth(date.getMonth() - 1)
128
- return date.toISOString().split('T')[0]
135
+ return formatLocalDate(date)
129
136
  })(),
130
137
  max: (() => {
131
- var max = new Date()
138
+ const max = new Date()
132
139
  max.setMonth(max.getMonth() + 1)
133
- return max.toISOString().split('T')[0]
140
+ return formatLocalDate(max)
134
141
  })()
135
142
  },
136
- value: new Date().toISOString().split('T')[0]
143
+ value: formatLocalDate(new Date())
137
144
  // handlers: { change: this._submit.bind(this) }
138
145
  }
139
146
  ]
@@ -387,15 +394,16 @@ class CostingReport extends connect(store)(localize(i18next)(PageView)) {
387
394
  _modifyDateRange(e) {
388
395
  const fromDate = e.currentTarget.value
389
396
 
390
- let min = new Date(fromDate)
391
- let max = new Date(fromDate)
392
- max.setMonth(max.getMonth() + 2)
397
+ const minDate = new Date(fromDate)
398
+ if (Number.isNaN(minDate.getTime())) return
393
399
 
394
- min = min.toISOString().split('T')[0]
395
- max = max.toISOString().split('T')[0]
400
+ const maxDate = new Date(minDate)
401
+ maxDate.setMonth(maxDate.getMonth() + 2)
396
402
 
397
- if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
403
+ const min = formatLocalDate(minDate)
404
+ const max = formatLocalDate(maxDate)
398
405
 
406
+ if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
399
407
  if (this._toDateInput.value > max) this._toDateInput.value = max
400
408
 
401
409
  this._toDateInput.max = max
@@ -10,6 +10,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
10
10
  import { client, gqlContext, PageView, store } from '@things-factory/shell'
11
11
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
12
12
 
13
+ function formatLocalDate(date = new Date()) {
14
+ const year = date.getFullYear()
15
+ const month = String(date.getMonth() + 1).padStart(2, '0')
16
+ const day = String(date.getDate()).padStart(2, '0')
17
+ return `${year}-${month}-${day}`
18
+ }
19
+
13
20
  class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageView)) {
14
21
  static get styles() {
15
22
  return css`
@@ -118,12 +125,12 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
118
125
  type: 'date',
119
126
  props: {
120
127
  searchOper: 'eq',
121
- max: new Date().toISOString().split('T')[0]
128
+ max: formatLocalDate(new Date())
122
129
  },
123
130
  value: (() => {
124
- let date = new Date()
131
+ const date = new Date()
125
132
  date.setMonth(date.getMonth() - 1)
126
- return date.toISOString().split('T')[0]
133
+ return formatLocalDate(date)
127
134
  })(),
128
135
  handlers: { change: this._modifyDateRange.bind(this) }
129
136
  },
@@ -134,17 +141,16 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
134
141
  props: {
135
142
  searchOper: 'eq',
136
143
  min: (() => {
137
- let date = new Date()
144
+ const date = new Date()
138
145
  date.setMonth(date.getMonth() - 1)
139
- return date.toISOString().split('T')[0]
146
+ return formatLocalDate(date)
140
147
  })(),
141
148
  max: (() => {
142
- var max = new Date()
143
- max.setUTCDate(max.getDate())
144
- return max.toISOString().split('T')[0]
149
+ const max = new Date()
150
+ return formatLocalDate(max)
145
151
  })()
146
152
  },
147
- value: new Date().toISOString().split('T')[0],
153
+ value: formatLocalDate(new Date()),
148
154
  handlers: { change: this._submit.bind(this) }
149
155
  },
150
156
  {
@@ -753,12 +759,10 @@ class InboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVie
753
759
 
754
760
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
755
761
 
756
- let min = new Date(fromDate)
757
- let today = new Date()
758
- today.setHours(0, 0, 0, 0)
759
-
760
- min = min.toISOString().split('T')[0]
762
+ const minDate = new Date(fromDate)
763
+ if (Number.isNaN(minDate.getTime())) return
761
764
 
765
+ const min = formatLocalDate(minDate)
762
766
  this._toDateInput.min = min
763
767
  this._submit()
764
768
  }