Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const age = (dob) => {
const dateOfBirth = parseDob(dob)
const now = new Date()
let age = timeYear.count(dateOfBirth, now)
var months = now.getMonth() - dateOfBirth.getMonth()
if (months < 0 || (months === 0 && now.getDate() < dateOfBirth.getDate())) {
age -= 1
}
return age
}
const age = (dob) => {
const dateOfBirth = parseDob(dob)
const now = new Date()
let age = timeYear.count(dateOfBirth, now)
var months = now.getMonth() - dateOfBirth.getMonth()
if (months < 0 || (months === 0 && now.getDate() < dateOfBirth.getDate())) {
age -= 1
}
return age
}
}
}
const columnWidth = Math.floor(width / columns) - 1
const innerWidth = columnWidth - paddingLeft - paddingRight
const xValues = data.map(xAccessor)
let x
let xTicks
let xFormat = d => d
if (props.xScale === 'time') {
xFormat = timeFormat(props.timeFormat)
const xTimes = xValues.map(d => d.getTime())
const domainTime = [min(xTimes), max(xTimes)]
const domain = domainTime.map(d => new Date(d))
let yearInteval = Math.round(timeYear.count(domain[0], domain[1]) / 3)
let time1 = timeYear.offset(domain[0], yearInteval).getTime()
let time2 = timeYear.offset(domain[1], -yearInteval).getTime()
x = scaleTime().domain(domain)
xTicks = [
domainTime[0],
sortBy(xTimes, d => Math.abs(d - time1))[0],
sortBy(xTimes, d => Math.abs(d - time2))[0],
domainTime[1]
]
.filter(deduplicate)
.map(d => new Date(d))
} else {
let domain = xValues.filter(deduplicate)
x = scalePoint().domain(domain)
constructor(props) {
super(props);
this.state = { xDragPos: 0, dragging: false, instructionsHidden: false };
this.width = null;
this.count = timeYear.count(this.props.minDate, this.props.maxDate);
this.scrubberWidth = this.props.divisionWidth * this.count;
this.scale = scaleTime({
domain: [this.props.minDate, this.props.maxDate],
range: [20, this.scrubberWidth - 20]
});
this._data = dodge(this.props.data, 14, d => d.date, this.scale);
this.lastActiveX = this._data[this.props.activePoint].x;
this.showTooltipDebounced = debounce(this.handleMouseOver, 300);
this.dragStarted = this.dragStarted.bind(this);
this.dragEnded = this.dragEnded.bind(this);
}