@byu-oit/vue-decision-processing-components 9.1.0 → 9.2.0
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/DetailsMission.vue +5 -2
- package/dateTimeFormat.js +29 -0
- package/package.json +1 -1
package/DetailsMission.vue
CHANGED
|
@@ -101,10 +101,13 @@ export default {
|
|
|
101
101
|
formatEndDate () {
|
|
102
102
|
if (!this.mission) return ''
|
|
103
103
|
const yyyyMmDd = /^[0-9]{4}-([0][1-9]||[1][0-2])-([0][1-9]||[1-2][0-9]||[3][0-1])$/
|
|
104
|
+
const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
|
|
104
105
|
if (this.mission.endMonth === 'Ongoing') return 'Ongoing'
|
|
105
106
|
const endDate = this.mission.endMonth
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
const yyyyMmDdResult = yyyyMmDd.test(endDate)
|
|
108
|
+
const yyyyMmResult = yyyyMm.test(endDate)
|
|
109
|
+
if (!endDate || (!yyyyMmDdResult && !yyyyMmResult)) return ''
|
|
110
|
+
if (!yyyyMmDdResult) return dayjs(endDate).format('YYYY/MM')
|
|
108
111
|
return dayjs(endDate).format('YYYY/MM/DD')
|
|
109
112
|
},
|
|
110
113
|
estimateStartDate() {
|
package/dateTimeFormat.js
CHANGED
|
@@ -42,6 +42,7 @@ export const timeFormat = value => {
|
|
|
42
42
|
return fmt(new Date(value))
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// V2 versions of these functions were written to allow Ensign to view applications based on their new block schedule.
|
|
45
46
|
export const yearTermFormat = value => {
|
|
46
47
|
if (!value) return value
|
|
47
48
|
if (!/^[0-9]{4}[1345]$/.test(value)) return value
|
|
@@ -54,6 +55,20 @@ export const yearTermFormat = value => {
|
|
|
54
55
|
return value.substr(0, 4).concat(term)
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
export const yearTermFormatV2 = value => {
|
|
59
|
+
if (!value) return value
|
|
60
|
+
if (!/^[0-9]{4}[1-6]$/.test(value)) return value
|
|
61
|
+
const term = {
|
|
62
|
+
1: 'W1',
|
|
63
|
+
2: 'W2',
|
|
64
|
+
3: 'S1',
|
|
65
|
+
4: 'S2',
|
|
66
|
+
5: 'F1',
|
|
67
|
+
6: 'F2'
|
|
68
|
+
}[value.substr(-1)]
|
|
69
|
+
return value.substr(0, 4).concat(term)
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
export const yearTermLongFormat = value => {
|
|
58
73
|
if (!value) return value
|
|
59
74
|
if (!/^[0-9]{4}[1345]$/.test(value)) return value
|
|
@@ -65,3 +80,17 @@ export const yearTermLongFormat = value => {
|
|
|
65
80
|
}[value.substr(-1)]
|
|
66
81
|
return `${term} ${value.substr(0, 4)}`
|
|
67
82
|
}
|
|
83
|
+
|
|
84
|
+
export const yearTermLongFormatV2 = value => {
|
|
85
|
+
if (!value) return value
|
|
86
|
+
if (!/^[0-9]{4}[1-6]$/.test(value)) return value
|
|
87
|
+
const term = {
|
|
88
|
+
1: 'Winter 1',
|
|
89
|
+
2: 'Winter 2',
|
|
90
|
+
3: 'Spring 1',
|
|
91
|
+
4: 'Spring 2',
|
|
92
|
+
5: 'Fall 1',
|
|
93
|
+
6: 'Fall 2'
|
|
94
|
+
}[value.substr(-1)]
|
|
95
|
+
return `${term} ${value.substr(0, 4)}`
|
|
96
|
+
}
|
package/package.json
CHANGED