@byu-oit/vue-decision-processing-components 8.35.11 → 8.35.12

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.
Files changed (2) hide show
  1. package/DetailsMission.vue +56 -40
  2. package/package.json +1 -1
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  -->
16
16
  <template>
17
- <div v-if="mission">
17
+ <div v-if="mission.name">
18
18
  <div v-if="condensed">
19
19
  <template v-if="mission.name">
20
20
  <div>{{ mission.name }} - {{ mission.type }}</div>
@@ -31,22 +31,22 @@
31
31
  </div>
32
32
  <table v-else class="table table-borderless table-sm">
33
33
  <thead>
34
- <tr>
35
- <th>Mission Name</th>
36
- <th>Mission Type</th>
37
- <th>Mission Language</th>
38
- <th>Mission Dates</th>
39
- <th>Months of Service</th>
40
- </tr>
34
+ <tr>
35
+ <th>Mission Name</th>
36
+ <th>Mission Type</th>
37
+ <th>Mission Language</th>
38
+ <th>Mission Dates</th>
39
+ <th>Months of Service</th>
40
+ </tr>
41
41
  </thead>
42
42
  <tbody>
43
- <tr>
44
- <td>{{mission.name}}</td>
45
- <td>{{mission.type}}</td>
46
- <td>{{mission.language}}</td>
47
- <td>{{mission.startMonth}} - {{mission.endMonth}}</td>
48
- <td>{{monthsOfService}}</td>
49
- </tr>
43
+ <tr>
44
+ <td>{{mission.name}}</td>
45
+ <td>{{mission.type}}</td>
46
+ <td>{{mission.language}}</td>
47
+ <td>{{formatStartDate}} - {{formatEndDate}}</td>
48
+ <td>{{monthsOfService}}</td>
49
+ </tr>
50
50
  </tbody>
51
51
  </table>
52
52
  </div>
@@ -55,34 +55,50 @@
55
55
  </div>
56
56
  </template>
57
57
  <script>
58
- import { mapState } from 'vuex'
59
- import dayjs from 'dayjs';
58
+ import { mapState } from 'vuex'
59
+ import dayjs from 'dayjs';
60
60
 
61
61
 
62
- export default {
63
- name: 'DetailsMission',
64
- props: {
65
- condensed: {
66
- type: Boolean
67
- }
62
+ export default {
63
+ name: 'DetailsMission',
64
+ props: {
65
+ condensed: {
66
+ type: Boolean
67
+ }
68
+ },
69
+ computed: {
70
+ ...mapState({
71
+ mission: state => state.application.mission
72
+ }),
73
+ formatStartDate () {
74
+ if (!this.mission) return ''
75
+ const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
76
+ const startMonth = this.mission.startMonth
77
+ if (!startMonth || !yyyyMm.test(startMonth)) return ''
78
+ return dayjs(startMonth).format('YYYY/MM')
79
+ },
80
+ formatEndDate () {
81
+ if (!this.mission) return ''
82
+ const yyyyMmDd = /^[0-9]{4}-([0][1-9]||[1][0-2])-([0][1-9]||[1-2][0-9]||[3][0-1])$/
83
+ if (this.mission.endMonth === 'Ongoing') return 'Ongoing'
84
+ const endDate = this.mission.endMonth
85
+ if (!endDate || !yyyyMmDd.test(endDate)) return ''
86
+ console.log(`END_DATE: ${dayjs(endDate).format('YYYY/MM/DD')}`)
87
+ return dayjs(endDate).format('YYYY/MM/DD')
68
88
  },
69
- computed: {
70
- ...mapState({
71
- mission: state => state.application.mission
72
- }),
73
- monthsOfService () {
74
- if (!this.mission) return ''
75
- const yyyyMm = /^[0-9]{4}-[0-9]{1,2}$/
76
- const startMonth = this.mission.startMonth
77
- if (!startMonth || !yyyyMm.test(startMonth)) return ''
78
- const endMonth = (this.mission.endMonth === 'Ongoing') ? dayjs().format('YYYY-MM') : dayjs(this.mission.startMonth).format('YYYY-MM')
79
- if (!endMonth || !yyyyMm.test(endMonth)) return ''
80
- const [endY, endM] = endMonth.split('-')
81
- const [startY, startM] = startMonth.split('-')
82
- const mAdjust = Number(endM) - Number(startM)
83
- const yDiff = Number(endY) - Number(startY)
84
- return 12 * yDiff + mAdjust
85
- }
89
+ monthsOfService () {
90
+ if (!this.mission) return ''
91
+ const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
92
+ const startMonth = this.mission.startMonth
93
+ if (!startMonth || !yyyyMm.test(startMonth)) return ''
94
+ const endMonth = (this.mission.endMonth === 'Ongoing') ? dayjs().format('YYYY-MM') : dayjs(this.mission.endMonth).format('YYYY-MM')
95
+ if (!endMonth || !yyyyMm.test(endMonth)) return ''
96
+ const [endY, endM] = endMonth.split('-')
97
+ const [startY, startM] = startMonth.split('-')
98
+ const mAdjust = Number(endM) - Number(startM)
99
+ const yDiff = Number(endY) - Number(startY)
100
+ return 12 * yDiff + mAdjust
86
101
  }
87
102
  }
103
+ }
88
104
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.35.11",
3
+ "version": "8.35.12",
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",