Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function timeRemaining (totalLength, completedLength, downloadSpeed, gt1d) {
const remainingLength = totalLength - completedLength
let secs = Math.ceil(remainingLength / downloadSpeed)
if (secs <= 0) {
return ''
} else if (secs > 86400) {
return gt1d
} else {
return date.formatDate(secs, 'HH:mm:ss')
}
// if (secs > 86400) {
// return `${prefix} ${i.gt1d} ${suffix}`
// }
// if (secs > 3600) {
// hours = `${Math.floor(secs / 3600)}:`
// secs %= 3600
// minutes = `${Math.floor(secs / 60)}:`
// secs %= 60
// return
// }
// if (secs > 60) {
// minutes = `${Math.floor(secs / 60)}:`
// secs %= 60
// }
}
data () {
return {
// model: '2016-09-18T10:45:00.000Z',
model: undefined,
modelVar: undefined,
// model: 0,
defaultValue: '2016-09-18T10:45:00.000Z',
format: 'MMMM D, YYYY [at] h:mm [[]a[\\]]',
minMaxModel: date.formatDate(day),
min: date.subtractFromDate(day, {days: 5}),
max: date.addToDate(day, {days: 4, month: 1, minutes: 10})
}
},
computed: {
}).catch((error) => {
vm.busy = false
let errormessage = (error.response && error.response.data && error.response.data.error && error.response.data.error.message) ? error.response.data.error.message
: (error.response && error.response.statusText) ? error.response.statusText : error.message
vm.chats[0].messages.push({
id: new Date(),
name: '', // 'HABot',
text: [errormessage],
avatar: 'statics/icons/icon-192x192.png',
bgColor: 'red',
textColor: 'white',
stamp: date.formatDate(new Date(), 'HH:mm')
})
})
get () {
const endDate = addSeconds(this.edit.startDate, this.edit.duration)
return date.formatDate(endDate, 'HH:mm')
},
set (val) {
today () {
let today = Date.now()
return date.formatDate(today, 'YYYY-MM-DD')
},
oneWeekAgo () {
get () {
return date.formatDate(this.edit.dateEnd, 'HH:mm')
},
set (val) {
get bookingDate() {
return date.formatDate(this.createdAt, "DD MMM YYYY");
}
}
get () {
return date.formatDate(this.edit.date, 'HH:mm')
},
set (val) {
getSqlDateFormat: function (dateObject, withTime) {
if (withTime) {
return date.formatDate(dateObject, 'YYYY-MM-DDTHH:mm:ssZ')
}
else {
return date.formatDate(dateObject, 'YYYY-MM-DD')
}
}
}
format: (val: Date) => `${date.formatDate(val, 'YYYY/MM/DD HH:mm:ss')}`
}