diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-04-20 09:00:25 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-04-20 09:00:25 +0200 |
commit | d04aeaa17e628f13d1a590a32ae96bc7d35775b5 (patch) | |
tree | 36ea8e5dd06b5e8c671e39a2185675042787ef38 /git/objects/commit.py | |
parent | fcb6e8832a94776d670095935a7da579a111c028 (diff) | |
parent | f77f9775277a100c7809698c75cb0855b07b884d (diff) | |
download | gitpython-d04aeaa17e628f13d1a590a32ae96bc7d35775b5.tar.gz |
Merge pull request #414 from nvie/support-full-datetimes-on-commits
Add support for getting "aware" datetime info
Diffstat (limited to 'git/objects/commit.py')
-rw-r--r-- | git/objects/commit.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/git/objects/commit.py b/git/objects/commit.py index d067b718..dc722f97 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -21,7 +21,8 @@ from .util import ( Serializable, parse_date, altz_to_utctz_str, - parse_actor_and_date + parse_actor_and_date, + from_timestamp, ) from git.compat import text_type @@ -145,6 +146,14 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # END handle attrs @property + def authored_datetime(self): + return from_timestamp(self.authored_date, self.author_tz_offset) + + @property + def committed_datetime(self): + return from_timestamp(self.committed_date, self.committer_tz_offset) + + @property def summary(self): """:return: First line of the commit message""" return self.message.split('\n', 1)[0] |