@things-factory/work-shift 7.0.1-alpha.9 → 7.0.1-alpha.92
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/client/pages/work-shift.ts +1 -4
- package/dist-client/pages/work-shift.js +1 -4
- package/dist-client/pages/work-shift.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/work-shift-range.js +3 -9
- package/dist-server/controllers/work-shift-range.js.map +1 -1
- package/dist-server/service/work-shift/work-shift.js +1 -1
- package/dist-server/service/work-shift/work-shift.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/controllers/work-shift-range.ts +6 -24
- package/server/service/work-shift/work-shift.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/work-shift",
|
|
3
|
-
"version": "7.0.1-alpha.
|
|
3
|
+
"version": "7.0.1-alpha.92",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@things-factory/auth-base": "^7.0.1-alpha.
|
|
31
|
-
"@things-factory/env": "^7.0.1-alpha.
|
|
32
|
-
"@things-factory/shell": "^7.0.1-alpha.
|
|
30
|
+
"@things-factory/auth-base": "^7.0.1-alpha.92",
|
|
31
|
+
"@things-factory/env": "^7.0.1-alpha.71",
|
|
32
|
+
"@things-factory/shell": "^7.0.1-alpha.90",
|
|
33
33
|
"moment-timezone": "^0.5.40"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "9cd59ab35277b7c8ac1e3677beb4bdca89a97980"
|
|
36
36
|
}
|
|
@@ -30,19 +30,13 @@ export async function getDateRangeForWorkShift(
|
|
|
30
30
|
|
|
31
31
|
const convertedFromDate = theDay.clone().add(fromDate, 'day')
|
|
32
32
|
const convertedToDate = theDay.clone().add(toDate, 'day')
|
|
33
|
-
const from = moment
|
|
34
|
-
.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
35
|
-
.toDate()
|
|
33
|
+
const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone).toDate()
|
|
36
34
|
const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone).toDate()
|
|
37
35
|
|
|
38
36
|
return [from, to]
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
export async function getDateRangeForWorkDate(
|
|
42
|
-
domain: Domain,
|
|
43
|
-
workDate: string,
|
|
44
|
-
options: { timezone?: string; format?: string }
|
|
45
|
-
) {
|
|
39
|
+
export async function getDateRangeForWorkDate(domain: Domain, workDate: string, options: { timezone?: string; format?: string }) {
|
|
46
40
|
const dateOptions = { timezone: domain.timezone || 'UTC', format: 'YYYY-MM-DD', ...options }
|
|
47
41
|
const { timezone, format } = dateOptions
|
|
48
42
|
|
|
@@ -69,12 +63,8 @@ export async function getDateRangeForWorkDate(
|
|
|
69
63
|
|
|
70
64
|
const convertedFromDate = theDay.clone().add(fromDate, 'day')
|
|
71
65
|
const convertedToDate = theDay.clone().add(toDate, 'day')
|
|
72
|
-
const from = moment
|
|
73
|
-
|
|
74
|
-
.toDate()
|
|
75
|
-
const to = moment
|
|
76
|
-
.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
77
|
-
.toDate()
|
|
66
|
+
const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone).toDate()
|
|
67
|
+
const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone).toDate()
|
|
78
68
|
|
|
79
69
|
if (!beginDate) {
|
|
80
70
|
beginDate = from
|
|
@@ -199,11 +189,7 @@ export async function getLatestWorkDateAndShift(domain: Domain, dateTime: Date,
|
|
|
199
189
|
if (j > 0) {
|
|
200
190
|
const { name, fromDate, fromTime, toDate, toTime } = workShifts[j - 1]
|
|
201
191
|
|
|
202
|
-
const from = moment.tz(
|
|
203
|
-
`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`,
|
|
204
|
-
'YYYY-MM-DD HH:mm:ss',
|
|
205
|
-
timezone
|
|
206
|
-
)
|
|
192
|
+
const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
207
193
|
const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
208
194
|
|
|
209
195
|
return {
|
|
@@ -218,11 +204,7 @@ export async function getLatestWorkDateAndShift(domain: Domain, dateTime: Date,
|
|
|
218
204
|
const convertedFromDate = days[i - 1].clone().add(fromDate, 'day')
|
|
219
205
|
const convertedToDate = days[i - 1].clone().add(toDate, 'day')
|
|
220
206
|
|
|
221
|
-
const from = moment.tz(
|
|
222
|
-
`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`,
|
|
223
|
-
'YYYY-MM-DD HH:mm:ss',
|
|
224
|
-
timezone
|
|
225
|
-
)
|
|
207
|
+
const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
226
208
|
const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
|
|
227
209
|
|
|
228
210
|
return {
|