{"action":"created","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1404","repository_url":"https://api.github.com/repos/yajra/laravel-datatables","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1404/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1404/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1404/events","html_url":"https://github.com/yajra/laravel-datatables/issues/1404","id":259842293,"number":1404,"title":"Order by Date","user":{"login":"piccard21","id":8790543,"avatar_url":"https://avatars1.githubusercontent.com/u/8790543?v=4","gravatar_id":"","url":"https://api.github.com/users/piccard21","html_url":"https://github.com/piccard21","followers_url":"https://api.github.com/users/piccard21/followers","following_url":"https://api.github.com/users/piccard21/following{/other_user}","gists_url":"https://api.github.com/users/piccard21/gists{/gist_id}","starred_url":"https://api.github.com/users/piccard21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piccard21/subscriptions","organizations_url":"https://api.github.com/users/piccard21/orgs","repos_url":"https://api.github.com/users/piccard21/repos","events_url":"https://api.github.com/users/piccard21/events{/privacy}","received_events_url":"https://api.github.com/users/piccard21/received_events","type":"User","site_admin":false},"labels":[{"id":431242877,"url":"https://api.github.com/repos/yajra/laravel-datatables/labels/need%20feedback","name":"need feedback","color":"f9d0c4","default":false},{"id":67904193,"url":"https://api.github.com/repos/yajra/laravel-datatables/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-22T14:57:04Z","updated_at":"2017-11-24T09:37:55Z","closed_at":null,"author_association":"NONE","body":"is it possible to order columns by date? I added a  **editColumn**-function, where  I format the date for my timezone ('d.m.Y').  Unfortunatley the sorting order is wrong, because laravel-datatables sorts by string. So I tried it by returning the date, formatted in my timezone & a timestamp which should be the sorting value:\r\n \r\n```\r\n->editColumn('created', function($col) {\r\n\treturn [\r\n\t\t'display' =>($col->created && $col->created != '0000-00-00 00:00:00') ? with(new Carbon($col->created))->format('d.m.Y') : '',\r\n\t\t'timestamp' =>($col->created && $col->created != '0000-00-00 00:00:00') ? with(new Carbon($col->created))->timestamp : ''\r\n\t];\r\n})\r\n```\r\n\r\nInside the JS I added this:\r\n`\t\t\t\t{\r\n\t\t\t\t\t'name': 'created',\r\n\t\t\t\t\t'data': 'created',\r\n\t\t\t\t\t'type': 'num',\r\n\t\t\t\t\t'render': {\r\n\t\t\t\t\t\t'_': 'display',\r\n\t\t\t\t\t\t'order': 'timestamp'\r\n\t\t\t\t\t}\r\n\t\t\t\t}`\r\n\r\nDatatables displays everything correctly, but when I want to sort by date, I get 'undefined index: created'. Inside CollectionEngine->ordering() it fails while **$cmp = strnatcasecmp($first[$column], $second[$column]);** because column is now **created.timestamp/created.display** and not **created** anymore.\r\n\r\nSo, in the end, is it possible to sort by date and if so, can anyone provide an example?\r\n\r\nThank you very much :-)\r\n\r\n\r\n- Ubuntu 16.04\r\n- PHP 7.0.18\r\n- Laravel 5.4.36\r\n- Laravel-Datatables 7.10.1\r\n"},"comment":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/comments/346784673","html_url":"https://github.com/yajra/laravel-datatables/issues/1404#issuecomment-346784673","issue_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1404","id":346784673,"user":{"login":"carlituxman","id":2116042,"avatar_url":"https://avatars2.githubusercontent.com/u/2116042?v=4","gravatar_id":"","url":"https://api.github.com/users/carlituxman","html_url":"https://github.com/carlituxman","followers_url":"https://api.github.com/users/carlituxman/followers","following_url":"https://api.github.com/users/carlituxman/following{/other_user}","gists_url":"https://api.github.com/users/carlituxman/gists{/gist_id}","starred_url":"https://api.github.com/users/carlituxman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlituxman/subscriptions","organizations_url":"https://api.github.com/users/carlituxman/orgs","repos_url":"https://api.github.com/users/carlituxman/repos","events_url":"https://api.github.com/users/carlituxman/events{/privacy}","received_events_url":"https://api.github.com/users/carlituxman/received_events","type":"User","site_admin":false},"created_at":"2017-11-24T09:37:55Z","updated_at":"2017-11-24T09:37:55Z","author_association":"NONE","body":"I've tried it with Query Builder and not ordering the date column. Change icon ordering but not reorder"}}
{"actor":{"display_login":"carlituxman"}}