@byu-oit/vue-decision-processing-components 9.0.17 → 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.
@@ -90,17 +90,24 @@ export default {
90
90
  formatStartDate () {
91
91
  if (!this.mission) return ''
92
92
  const yyyyMmDd = /^[0-9]{4}-([0][1-9]||[1][0-2])-([0][1-9]||[1-2][0-9]||[3][0-1])$/
93
+ const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
93
94
  const startMonth = this.mission.startMonth
94
- if (!startMonth || !yyyyMmDd.test(startMonth)) return ''
95
+ const yyyyMmDdResult = yyyyMmDd.test(startMonth)
96
+ const yyyyMmResult = yyyyMm.test(startMonth)
97
+ if (!startMonth || (!yyyyMmDdResult && !yyyyMmResult)) return ''
98
+ if (!yyyyMmDdResult) return dayjs(startMonth).format('YYYY/MM')
95
99
  return dayjs(startMonth).format('YYYY/MM/DD')
96
100
  },
97
101
  formatEndDate () {
98
102
  if (!this.mission) return ''
99
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])$/
100
105
  if (this.mission.endMonth === 'Ongoing') return 'Ongoing'
101
106
  const endDate = this.mission.endMonth
102
- if (!endDate || !yyyyMmDd.test(endDate)) return ''
103
- console.log(`END_DATE: ${dayjs(endDate).format('YYYY/MM/DD')}`)
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')
104
111
  return dayjs(endDate).format('YYYY/MM/DD')
105
112
  },
106
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.0.17",
3
+ "version": "9.2.0",
4
4
  "description": "Vue components shared between decision processing systems for the CES schools.",
5
5
  "dependencies": {
6
6
  "@fortawesome/fontawesome-free": "^5.15.4",