const formData = new FormData()
this.selectedFile = event.target.files[0]
formData.append('myFile', this.selectedFile, this.selectedFile.name)
this.$http.post('http://127.0.0.1:8000/upload', formData).then(response => {
console.log('onUpload file ', formData.length ); // 1
status = response.status;
console.log('status --> ', status)
// get status text
response.statusText;
}, response => {
// error callback
console.log('errror ')
});
let employeeApi = new restApi(this.$props.data_table);
let employeeColumn = new restApi(this.$props.data_columns);
let arr = [employeeApi.list(), employeeColumn.list()];
Promise.All(arr).then(res=> {
this.items = res[0].data;
this.columns = res[1].data;
});
module.exports = {
runtimeCompiler: true
}
employeeList: function() {
return this.items.filter(item =>
Object.keys(this.filterItems).reduce((acc, filterKey) => {
let filterCondition = this.filterItems[filterKey];
return acc && !!~item[filterKey].indexOf(filterCondition);
}, true)
).sort(....);
}
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
primary_author VARCHAR(100) NULL
);
function diff(string $from, string $to): string
{
return date_diff(new \DateTime($from), new \DateTime($to))->format('%h:%i');
}
$arHistory['DATE_FROM'] = '2018-05-03 00:00:00';
$arHistory['DATE_TO'] = '2018-05-03 23:59:59';
echo diff($arHistory['DATE_FROM'], $arHistory['DATE_TO']);
function diff(string $from, string $to): string
{
$start = (new \DateTime($from))->getTimestamp();
$end = (new \DateTime($to))->getTimestamp();
$result = round(abs($start - $end) / 60 / 60, 4);
$hours = (int)$result;
$minutes = (int)(($result - $hours) * 60);
return $hours . ':' . $minutes;
}
$arHistory['DATE_FROM'] = '2018-05-03 00:00:00';
$arHistory['DATE_TO'] = '2018-05-03 23:59:59';
echo diff($arHistory['DATE_FROM'], $arHistory['DATE_TO']);
function diff(string $from, string $to): string
{
return (new \DateTime($from))->diff(new \DateTime($to))->format('%h:%i');
}
$arHistory['DATE_FROM'] = '2018-05-03 00:00:00';
$arHistory['DATE_TO'] = '2018-05-03 23:59:59';
echo diff($arHistory['DATE_FROM'], $arHistory['DATE_TO']);
$from = new \DateTime('2018-05-03 00:00:00');
$to = new \DateTime('2018-05-03 23:59:59');
$period = new \DatePeriod($from, new \DateInterval('PT30M'), $to);
$result = [];
foreach ($period as $dateTime) {
$dinner = clone $dateTime;
$dinner->add(new \DateInterval('PT30M'));
$result[] = $dateTime->format('H:i') . ' - ' . $dinner->format('H:i');
}
var_dump($result);