{"action":"created","issue":{"url":"https://api.github.com/repos/bear/parsedatetime/issues/85","labels_url":"https://api.github.com/repos/bear/parsedatetime/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/bear/parsedatetime/issues/85/comments","events_url":"https://api.github.com/repos/bear/parsedatetime/issues/85/events","html_url":"https://github.com/bear/parsedatetime/pull/85","id":73816279,"number":85,"title":"A bug cause datetime str (flag 3) being detected as time str (flag 2)","user":{"login":"philiptzou","id":809865,"avatar_url":"https://avatars.githubusercontent.com/u/809865?v=3","gravatar_id":"","url":"https://api.github.com/users/philiptzou","html_url":"https://github.com/philiptzou","followers_url":"https://api.github.com/users/philiptzou/followers","following_url":"https://api.github.com/users/philiptzou/following{/other_user}","gists_url":"https://api.github.com/users/philiptzou/gists{/gist_id}","starred_url":"https://api.github.com/users/philiptzou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philiptzou/subscriptions","organizations_url":"https://api.github.com/users/philiptzou/orgs","repos_url":"https://api.github.com/users/philiptzou/repos","events_url":"https://api.github.com/users/philiptzou/events{/privacy}","received_events_url":"https://api.github.com/users/philiptzou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-07T02:56:15Z","updated_at":"2015-05-07T07:57:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bear/parsedatetime/pulls/85","html_url":"https://github.com/bear/parsedatetime/pull/85","diff_url":"https://github.com/bear/parsedatetime/pull/85.diff","patch_url":"https://github.com/bear/parsedatetime/pull/85.patch"},"body":"Here I have met a weird bug that a datetime str (flag 3) has been detected as time str (flag 2). Like this:\r\n\r\n```python\r\nimport parsedatetime as pdt\r\npdt.Calendar().parse('friday afternoon 3pm')\r\n```\r\n\r\nAfter I enabling the debug level logging:\r\n\r\n```\r\n...\r\n2015-05-06 19:32:19,857 DEBUG: parse (bottom) [  after  3pm][noon][  after][ 3pm]\r\n...\r\n```\r\n\r\nSo the reason is because https://github.com/bear/parsedatetime/blob/master/parsedatetime/__init__.py#L1631-L1643 split word \"afternoon\" into \"after\" and \"noon\". And the remain \"after\" causes `Calendar._evalModifier2` being called and dropped the existed `dateFlag = 1` (So perhaps there's another bug in `_evalModifier2`).\r\n\r\nIn this fix I added \"afternoon\" phrase in \"re_sources\", and use `\\b` to prevent words being split.\r\n\r\nI have all tests passed on my machine."},"comment":{"url":"https://api.github.com/repos/bear/parsedatetime/issues/comments/99760392","html_url":"https://github.com/bear/parsedatetime/pull/85#issuecomment-99760392","issue_url":"https://api.github.com/repos/bear/parsedatetime/issues/85","id":99760392,"user":{"login":"philiptzou","id":809865,"avatar_url":"https://avatars.githubusercontent.com/u/809865?v=3","gravatar_id":"","url":"https://api.github.com/users/philiptzou","html_url":"https://github.com/philiptzou","followers_url":"https://api.github.com/users/philiptzou/followers","following_url":"https://api.github.com/users/philiptzou/following{/other_user}","gists_url":"https://api.github.com/users/philiptzou/gists{/gist_id}","starred_url":"https://api.github.com/users/philiptzou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philiptzou/subscriptions","organizations_url":"https://api.github.com/users/philiptzou/orgs","repos_url":"https://api.github.com/users/philiptzou/repos","events_url":"https://api.github.com/users/philiptzou/events{/privacy}","received_events_url":"https://api.github.com/users/philiptzou/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T07:57:26Z","updated_at":"2015-05-07T07:57:26Z","body":"Here's the another bug. Parsedatetime wrongly detect \"next monday 11am\" as a time(2) but not datetime(3). This's because the nested `parse()` calling overwrite the existed `dateFlag` and `timeFlag`.\r\n\r\nhttps://github.com/bear/parsedatetime/commit/3dd73436049d07ee9db5ed64079749555e0bd958 fixed the bug."}}