{"action":"created","issue":{"url":"https://api.github.com/repos/twigphp/Twig/issues/2566","repository_url":"https://api.github.com/repos/twigphp/Twig","labels_url":"https://api.github.com/repos/twigphp/Twig/issues/2566/labels{/name}","comments_url":"https://api.github.com/repos/twigphp/Twig/issues/2566/comments","events_url":"https://api.github.com/repos/twigphp/Twig/issues/2566/events","html_url":"https://github.com/twigphp/Twig/issues/2566","id":262486017,"number":2566,"title":"date filter comparison only works with 'Y-m-d' format","user":{"login":"jin78","id":13119959,"avatar_url":"https://avatars1.githubusercontent.com/u/13119959?v=4","gravatar_id":"","url":"https://api.github.com/users/jin78","html_url":"https://github.com/jin78","followers_url":"https://api.github.com/users/jin78/followers","following_url":"https://api.github.com/users/jin78/following{/other_user}","gists_url":"https://api.github.com/users/jin78/gists{/gist_id}","starred_url":"https://api.github.com/users/jin78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jin78/subscriptions","organizations_url":"https://api.github.com/users/jin78/orgs","repos_url":"https://api.github.com/users/jin78/repos","events_url":"https://api.github.com/users/jin78/events{/privacy}","received_events_url":"https://api.github.com/users/jin78/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-03T16:01:36Z","updated_at":"2017-10-03T18:15:07Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\ndate comparison only works when providing an english US date format in the form of d-m-Y. e.g: 2017-12-31 for december 31,\r\n\r\nso assuming that date1 and date2 are 2 DateTime instances, this works fine:\r\n`{% if date1|format( 'Y-m-d' ) < date2|format( 'Y-m-d' ) %}`\r\n\r\nBut changing to au european format of 'dd/mm/YYYY' this does NOT work:\r\n``{% if date1|format( 'd/m/Y' ) < date2|format( 'd/m/Y' ) %}``\r\n\r\nThe official documentation does not provide any information about this and remains slim about what you can and can't do with the date variable. \r\n[https://twig.symfony.com/doc/2.x/filters/date.html](https://twig.symfony.com/doc/2.x/filters/date.html)\r\n\r\nFor example, is it possible to use DateTime methods such as diff() or modify()?"},"comment":{"url":"https://api.github.com/repos/twigphp/Twig/issues/comments/333931992","html_url":"https://github.com/twigphp/Twig/issues/2566#issuecomment-333931992","issue_url":"https://api.github.com/repos/twigphp/Twig/issues/2566","id":333931992,"user":{"login":"xabbuh","id":1957048,"avatar_url":"https://avatars0.githubusercontent.com/u/1957048?v=4","gravatar_id":"","url":"https://api.github.com/users/xabbuh","html_url":"https://github.com/xabbuh","followers_url":"https://api.github.com/users/xabbuh/followers","following_url":"https://api.github.com/users/xabbuh/following{/other_user}","gists_url":"https://api.github.com/users/xabbuh/gists{/gist_id}","starred_url":"https://api.github.com/users/xabbuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xabbuh/subscriptions","organizations_url":"https://api.github.com/users/xabbuh/orgs","repos_url":"https://api.github.com/users/xabbuh/repos","events_url":"https://api.github.com/users/xabbuh/events{/privacy}","received_events_url":"https://api.github.com/users/xabbuh/received_events","type":"User","site_admin":false},"created_at":"2017-10-03T18:15:07Z","updated_at":"2017-10-03T18:15:07Z","author_association":"CONTRIBUTOR","body":"Well, the `date` filter is meant to turn a date into a human readable format. What's the point in comparing such two strings? If you just want to compare two dates, just compare these two variables:\r\n\r\n```twig\r\n{% if date1 > date2 %}\r\n    date2 is before date1\r\n{% endif %}\r\n```"}}
{"actor":{"display_login":"xabbuh"}}