{"action":"created","issue":{"url":"https://api.github.com/repos/wanasit/chrono/issues/75","labels_url":"https://api.github.com/repos/wanasit/chrono/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/wanasit/chrono/issues/75/comments","events_url":"https://api.github.com/repos/wanasit/chrono/issues/75/events","html_url":"https://github.com/wanasit/chrono/issues/75","id":122374810,"number":75,"title":"Support for DD/MM/YYYY","user":{"login":"davidgilbertson","id":4443482,"avatar_url":"https://avatars.githubusercontent.com/u/4443482?v=3","gravatar_id":"","url":"https://api.github.com/users/davidgilbertson","html_url":"https://github.com/davidgilbertson","followers_url":"https://api.github.com/users/davidgilbertson/followers","following_url":"https://api.github.com/users/davidgilbertson/following{/other_user}","gists_url":"https://api.github.com/users/davidgilbertson/gists{/gist_id}","starred_url":"https://api.github.com/users/davidgilbertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidgilbertson/subscriptions","organizations_url":"https://api.github.com/users/davidgilbertson/orgs","repos_url":"https://api.github.com/users/davidgilbertson/repos","events_url":"https://api.github.com/users/davidgilbertson/events{/privacy}","received_events_url":"https://api.github.com/users/davidgilbertson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-15T21:49:47Z","updated_at":"2016-01-03T07:42:48Z","closed_at":"2016-01-03T07:42:48Z","body":"In my part of the world, dates are written in the format DD/MM/YYYY. Should it be possible to add this as a parser or refiner that overrides the default USA-style MM/DD/YYYY? Here's my code, but I still get the wrong result:\r\n```javascript\r\n    // add a parser to the chrono package that handles dd/mm/yyyy (it's american)\r\n    var ddMmYyyyParser = new chrono.Parser();\r\n\r\n    ddMmYyyyParser.pattern = function () {\r\n        return /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\r\n    };\r\n\r\n    // This function will be called when matched pattern is found\r\n    ddMmYyyyParser.extract = function(text, ref, match, opt) {\r\n        console.log('> match:', match); // yep this gets returned and matched properly\r\n\r\n        return new chrono.ParsedResult({\r\n            ref: ref,\r\n            text: match[0],\r\n            index: match.index,\r\n            start: {\r\n                day: match[1],\r\n                month: match[2],\r\n                year: match[3],\r\n            }\r\n        });\r\n    }\r\n\r\n    window.customChrono = new chrono.Chrono();\r\n    customChrono.parsers.push(ddMmYyyyParser);\r\n\r\n    var someDate = customChrono.parseDate('1/2/2000');\r\n    console.log('> customChrono:', someDate); // returns jan 2, not feb 1.\r\n```\r\n\r\nThere is a similar issue [here](https://github.com/wanasit/chrono/issues/63) about internationalisation."},"comment":{"url":"https://api.github.com/repos/wanasit/chrono/issues/comments/168474844","html_url":"https://github.com/wanasit/chrono/issues/75#issuecomment-168474844","issue_url":"https://api.github.com/repos/wanasit/chrono/issues/75","id":168474844,"user":{"login":"wanasit","id":1537162,"avatar_url":"https://avatars.githubusercontent.com/u/1537162?v=3","gravatar_id":"","url":"https://api.github.com/users/wanasit","html_url":"https://github.com/wanasit","followers_url":"https://api.github.com/users/wanasit/followers","following_url":"https://api.github.com/users/wanasit/following{/other_user}","gists_url":"https://api.github.com/users/wanasit/gists{/gist_id}","starred_url":"https://api.github.com/users/wanasit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanasit/subscriptions","organizations_url":"https://api.github.com/users/wanasit/orgs","repos_url":"https://api.github.com/users/wanasit/repos","events_url":"https://api.github.com/users/wanasit/events{/privacy}","received_events_url":"https://api.github.com/users/wanasit/received_events","type":"User","site_admin":false},"created_at":"2016-01-03T07:42:48Z","updated_at":"2016-01-03T07:42:48Z","body":"@davidgilbertson Sorry for my super slow response.\r\n\r\nYour code is already correct, except you need to *insert the parser before the default one*.\r\n```\r\n// change\r\ncustomChrono.parsers.push(ddMmYyyyParser);\r\n// to\r\ncustomChrono.parsers.unshift(ddMmYyyyParser);\r\n```\r\n\r\nI'm trying to make selection easier, but haven't really finished and update the document for it.\r\nSee: https://github.com/wanasit/chrono/issues/71\r\n\r\n\r\n"}}