@byu-oit/vue-decision-processing-components 9.0.15 → 9.0.17

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 +40 -5
  2. package/package.json +1 -1
@@ -44,9 +44,15 @@
44
44
  <td>{{mission.name}}</td>
45
45
  <td>{{mission.type}}</td>
46
46
  <td>{{mission.language}}</td>
47
- <td>{{formatStartDate}} - {{formatEndDate}}</td>
47
+ <td v-if="estimateDate">{{estimateStartDate}} - {{estimateEndDate}}</td>
48
+ <td v-else>{{formatStartDate}} - {{formatEndDate}}</td>
48
49
  <td>{{monthsOfService}}</td>
49
50
  </tr>
51
+ <!-- Show disclaimer if one of the dates is estimated (if one date is missing but not both) -->
52
+ <tr v-if="estimateDate && (Boolean(this.mission.startMonth) !== Boolean(this.mission.endMonth))">
53
+ <td colspan="3"/>
54
+ <td style="max-width: 200px; font-size: 12px"><span style="color: red">*</span>This date was not provided and is an estimation.</td>
55
+ </tr>
50
56
  </tbody>
51
57
  </table>
52
58
  </div>
@@ -64,18 +70,29 @@ export default {
64
70
  props: {
65
71
  condensed: {
66
72
  type: Boolean
73
+ },
74
+ estimateDate: {
75
+ type: Boolean,
76
+ default: false
77
+ }
78
+ },
79
+ mounted() {
80
+ if (this.mission){
81
+ this.mission.startMonth = this.mission.startMonth.trim()
82
+ this.mission.endMonth = this.mission.endMonth.trim()
67
83
  }
68
84
  },
69
85
  computed: {
70
86
  ...mapState({
71
- mission: state => state.application.mission
87
+ mission: state => state.application.mission,
88
+ sex: state => state.application.personalRecords.sex ?? ''
72
89
  }),
73
90
  formatStartDate () {
74
91
  if (!this.mission) return ''
75
- const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
92
+ const yyyyMmDd = /^[0-9]{4}-([0][1-9]||[1][0-2])-([0][1-9]||[1-2][0-9]||[3][0-1])$/
76
93
  const startMonth = this.mission.startMonth
77
- if (!startMonth || !yyyyMm.test(startMonth)) return ''
78
- return dayjs(startMonth).format('YYYY/MM')
94
+ if (!startMonth || !yyyyMmDd.test(startMonth)) return ''
95
+ return dayjs(startMonth).format('YYYY/MM/DD')
79
96
  },
80
97
  formatEndDate () {
81
98
  if (!this.mission) return ''
@@ -86,6 +103,24 @@ export default {
86
103
  console.log(`END_DATE: ${dayjs(endDate).format('YYYY/MM/DD')}`)
87
104
  return dayjs(endDate).format('YYYY/MM/DD')
88
105
  },
106
+ estimateStartDate() {
107
+ if (!this.mission.startMonth && this.mission.endMonth) {
108
+ const isFemale = (this.sex === 'F')
109
+ const monthsOfMission = isFemale ? 18 : 24
110
+ return dayjs(this.mission.endMonth).subtract(monthsOfMission, 'month').format('YYYY/MM') + '*'
111
+ } else {
112
+ return this.formatStartDate
113
+ }
114
+ },
115
+ estimateEndDate() {
116
+ if (this.mission.startMonth && !this.mission.endMonth) {
117
+ const isFemale = (this.sex === 'F')
118
+ const monthsOfMission = isFemale ? 18 : 24
119
+ return dayjs(this.mission.startMonth).add(monthsOfMission, 'month').format('YYYY/MM') + '*'
120
+ } else {
121
+ return this.formatEndDate
122
+ }
123
+ },
89
124
  monthsOfService () {
90
125
  if (!this.mission) return ''
91
126
  const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.0.15",
3
+ "version": "9.0.17",
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",