22
33import com .infradna .tool .bridge_method_injector .WithBridgeMethods ;
44import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
5-
65import java .io .IOException ;
76import java .net .URL ;
87import java .util .AbstractList ;
98import java .util .ArrayList ;
109import java .util .Collections ;
10+ import java .util .Date ;
1111import java .util .List ;
1212
1313/**
@@ -42,11 +42,19 @@ public GitUser getAuthor() {
4242 return author ;
4343 }
4444
45+ public Date getAuthoredDate () {
46+ return GitHub .parseDate (author .date );
47+ }
48+
4549 @ WithBridgeMethods (value = GHAuthor .class , castRequired = true )
4650 public GitUser getCommitter () {
4751 return committer ;
4852 }
4953
54+ public Date getCommitDate () {
55+ return GitHub .parseDate (author .date );
56+ }
57+
5058 /**
5159 * Commit message.
5260 */
@@ -63,6 +71,7 @@ public int getCommentCount() {
6371 * @deprecated Use {@link GitUser} instead.
6472 */
6573 public static class GHAuthor extends GitUser {
74+ private String date ;
6675 }
6776
6877 public static class Stats {
@@ -272,10 +281,29 @@ public GHUser getAuthor() throws IOException {
272281 return resolveUser (author );
273282 }
274283
284+ /**
285+ * Gets the date the change was authored on.
286+ * @return the date the change was authored on.
287+ * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
288+ */
289+ public Date getAuthoredDate () throws IOException {
290+ return getCommitShortInfo ().getAuthoredDate ();
291+ }
292+
275293 public GHUser getCommitter () throws IOException {
276294 return resolveUser (committer );
277295 }
278296
297+ /**
298+ * Gets the date the change was committed on.
299+ *
300+ * @return the date the change was committed on.
301+ * @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
302+ */
303+ public Date getCommitDate () throws IOException {
304+ return getCommitShortInfo ().getCommitDate ();
305+ }
306+
279307 private GHUser resolveUser (User author ) throws IOException {
280308 if (author ==null || author .login ==null ) return null ;
281309 return owner .root .getUser (author .login );
0 commit comments