【发布时间】:2016-07-25 10:39:08
【问题描述】:
将 Vue.js (Vue-Tables https://www.npmjs.com/package/vue-tables) 与 laravel 一起使用。 数据已成功显示,但 daterangepicker (http://www.daterangepicker.com/) 根本没有排序。 无论我设置什么间隔,记录都不会显示。正在使用 carbon 解析该字段以返回所需的格式
public function getFootageDateAttribute($date)
{
return Carbon::parse($date)->format('d-m-Y');
}
在 js 文件中,我有 dateFormat: "DD-MM-YY", filterByColumn: true, dateColumns: ['footage_date'], 。当我使用 vue dev-tools 检查时,该字段是 footage_date: "03-04-2016"
如果我使用
对示例中的日期 (https://jsfiddle.net/matfish2/f5h8xwgn/) 进行硬编码// 感谢 Tomasz Nurkiewicz (Elegant method to generate array of random dates within two dates)
function randomDate(start, end) {
return moment(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
日期采用这种格式footage_date: "1974-03-27T18:19:40.364Z" 并且有效。
完整js文件http://pastebin.com/6hCe2eQL的Pastebin。客户端http://pastebin.com/xTUcAK98
【问题讨论】:
标签: laravel vue.js php-carbon daterangepicker vue-resource