Move html out of clin fields macro and fix initial values in pop date range when there is no form data

This commit is contained in:
leigh-mil
2019-09-25 10:42:40 -04:00
parent eef15f311f
commit 5e1ce65662
6 changed files with 256 additions and 198 deletions

View File

@@ -15,14 +15,20 @@ export default {
props: {
initialMinStartDate: String,
initialMaxEndDate: String,
initialStartDate: String,
initialEndDate: String,
initialStartDate: {
type: String,
default: null,
},
initialEndDate: {
type: String,
default: null,
},
clinIndex: Number,
},
data: function() {
var start = new Date(this.initialStartDate)
var end = new Date(this.initialEndDate)
var start = !!this.initialStartDate ? new Date(this.initialStartDate) : null
var end = !!this.initialEndDate ? new Date(this.initialEndDate) : null
var contractStart = new Date(this.initialMinStartDate)
var contractEnd = new Date(this.initialMaxEndDate)
@@ -60,7 +66,7 @@ export default {
},
calcMaxStartDate: function(date, end = this.contractEnd) {
if (date < end) {
if (!!date && date < end) {
return date
} else {
return end
@@ -68,7 +74,7 @@ export default {
},
calcMinEndDate: function(date, start = this.contractStart) {
if (date > start) {
if (!!date && date > start) {
return date
} else {
return start