react-native-chart-kit
Version:
If you're looking to **build a website or a cross-platform mobile app** – we will be happy to help you! Send a note to clients@ui1.io and we will be in touch with you shortly.
16 lines (13 loc) • 508 B
JavaScript
// returns a new date shifted a certain number of days (can be negative)
export function shiftDate(date, numDays) {
const newDate = new Date(date)
newDate.setDate(newDate.getDate() + numDays)
return newDate
}
export function getBeginningTimeForDate(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate())
}
// obj can be a parseable string, a millisecond timestamp, or a Date object
export function convertToDate(obj) {
return (obj instanceof Date) ? obj : (new Date(obj))
}