Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameScoreboard.date is off by one hour for evening games #77

Closed
dowski opened this issue Mar 29, 2018 · 5 comments
Closed

GameScoreboard.date is off by one hour for evening games #77

dowski opened this issue Mar 29, 2018 · 5 comments

Comments

@dowski
Copy link
Contributor

dowski commented Mar 29, 2018

Here's an example. The Indians' opener against the Mariners is at 10:10PM EDT tomorrow. However, GameScoreboard.date represents it as 9:10PM.

>>> s = mlbgame.day(2018, 3, 29, home="Indians", away="Indians")[0]
>>> s.game_start_time
'10:10PM'
>>> s.date
datetime.datetime(2018, 3, 29, 21, 10)
>>> s.date.strftime("%I:%M%p")
'09:10PM'

I'll get a pull request ready.

@trevor-viljoen
Copy link
Contributor

looks like this line: https://github.com/panzarino/mlbgame/blob/master/mlbgame/game.py#L214

If PM, it adds 11 rather than 12 hours.

@dowski
Copy link
Contributor Author

dowski commented Mar 29, 2018

Yep.

@dowski
Copy link
Contributor Author

dowski commented Mar 30, 2018

Just saw this today.

  File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2018/03/29 12:40 pm' does not match format '%Y/%m/%d %I:%M%p'

Looks like there can be a space between the time and the AM/PM designation sometimes. I'll need to account for that.

@dowski
Copy link
Contributor Author

dowski commented Mar 30, 2018

Updated the PR to account for that scenario.

@panzarino
Copy link
Owner

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants