Skip to content

Commit d3050f4

Browse files
committed
Fixed parsing for world's creation date.
1 parent 5b3a008 commit d3050f4

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Changelog
77
Try to always use the latest version.
88

99

10+
11+
.. v5.6.1
12+
13+
5.6.1 (2023-08-01)
14+
==================
15+
- Fixed parsing for world's creation date.
16+
17+
1018
.. v5.6.0
1119
1220
5.6.0 (2023-02-17)

tibiapy/__init__.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
"""Tibia.com parsing and fetching library."""
2-
__version__ = '5.6.0'
2+
__version__ = '5.6.1'
33
__author__ = 'Allan Galarza'
44
__license__ = 'Apache-2.0 License'
55

66
import logging
7+
from logging import NullHandler
78

89
from tibiapy import abc, enums, utils
9-
from tibiapy.house import *
10+
from tibiapy.bazaar import *
1011
from tibiapy.character import *
12+
from tibiapy.client import *
1113
from tibiapy.creature import *
12-
from tibiapy.event import *
1314
from tibiapy.enums import *
1415
from tibiapy.errors import *
16+
from tibiapy.event import *
1517
from tibiapy.forum import *
1618
from tibiapy.guild import *
1719
from tibiapy.highscores import *
20+
from tibiapy.house import *
1821
from tibiapy.kill_statistics import *
1922
from tibiapy.leaderboard import *
2023
from tibiapy.news import *
24+
from tibiapy.spell import *
2125
from tibiapy.tournament import *
2226
from tibiapy.world import *
23-
from tibiapy.bazaar import *
24-
from tibiapy.spell import *
25-
from tibiapy.client import *
26-
27-
from logging import NullHandler
2827

2928
logging.getLogger(__name__).addHandler(NullHandler())

tibiapy/world.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Models related to the worlds section in Tibia.com."""
2+
import datetime
23
import re
34
from collections import OrderedDict
45
from typing import List, TYPE_CHECKING
@@ -332,13 +333,9 @@ def _parse_world_info(self, world_info_table):
332333
self._parse_battleye_status(world_info.pop("battleye_status"))
333334
self.premium_only = "premium_type" in world_info
334335

335-
month, year = world_info.pop("creation_date").split("/")
336-
month = int(month)
337-
year = int(year)
338-
if year > 90:
339-
year += 1900
340-
else:
341-
year += 2000
336+
creation_date = datetime.datetime.strptime(world_info.pop("creation_date"), "%B %Y")
337+
month = creation_date.month
338+
year = creation_date.year
342339
self.creation_date = f"{year:d}-{month:02d}"
343340

344341
for k, v in world_info.items():

0 commit comments

Comments
 (0)