[ 
https://issues.apache.org/jira/browse/IO-676?focusedWorklogId=458455&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-458455
 ]

ASF GitHub Bot logged work on IO-676:
-------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jul/20 04:54
            Start Date: 14/Jul/20 04:54
    Worklog Time Spent: 10m 
      Work Description: Isira-Seneviratne commented on a change in pull request 
#124:
URL: https://github.com/apache/commons-io/pull/124#discussion_r454099519



##########
File path: src/main/java/org/apache/commons/io/FileUtils.java
##########
@@ -1624,6 +1631,119 @@ public static boolean isFileNewer(final File file, 
final long timeMillis) {
         return file.lastModified() > timeMillis;
     }
 
+    /**
+     * Tests if the specified <code>File</code> is newer than the specified
+     * <code>Instant</code>.
+     *
+     * @param file    the <code>File</code> of which the modification date
+     *                must be compared, must not be {@code null}
+     * @param instant the date reference, must not be {@code null}
+     * @return true if the <code>File</code> exists and has been modified
+     * after the given <code>Instant</code>.
+     * @throws IllegalArgumentException if the file or instant is {@code null}
+     */
+    public static boolean isFileNewer(final File file, final Instant instant) {
+        if (instant == null) {
+            throw new IllegalArgumentException("No specified instant");
+        }
+        return isFileNewer(file, instant.toEpochMilli());
+    }
+
+    /**
+     * Tests if the specified <code>File</code> is newer than the specified
+     * <code>ZonedDateTime</code>.
+     *
+     * @param file          the <code>File</code> of which the modification 
date
+     *                      must be compared, must not be {@code null}
+     * @param zonedDateTime the date reference, must not be {@code null}
+     * @return true if the <code>File</code> exists and has been modified
+     * after the given <code>ZonedDateTime</code>.
+     * @throws IllegalArgumentException if the file or zoned date time is 
{@code null}
+     */
+    public static boolean isFileNewer(final File file, final ZonedDateTime 
zonedDateTime) {
+        if (zonedDateTime == null) {
+            throw new IllegalArgumentException("No specified zonedDateTime");
+        }
+        return isFileNewer(file, zonedDateTime.toInstant());
+    }
+
+    /**
+     * Tests if the specified <code>File</code> is newer than the specified
+     * <code>LocalDateTime</code> at the system-default time zone.
+     *
+     * @param file          the <code>File</code> of which the modification 
date
+     *                      must be compared, must not be {@code null}
+     * @param localDateTime the date reference, must not be {@code null}
+     * @return true if the <code>File</code> exists and has been modified
+     * after the given <code>LocalDateTime</code> at the system-default time 
zone.
+     * @throws IllegalArgumentException if the file or local date time is 
{@code null}
+     */
+    public static boolean isFileNewer(final File file, final LocalDateTime 
localDateTime) {
+        return isFileNewer(file, localDateTime, ZoneId.systemDefault());
+    }
+
+    /**
+     * Tests if the specified <code>File</code> is newer than the specified
+     * <code>LocalDateTime</code> at the specified <code>ZoneId</code>.
+     *
+     * @param file          the <code>File</code> of which the modification 
date
+     *                      must be compared, must not be {@code null}
+     * @param localDateTime the date reference, must not be {@code null}
+     * @param zoneId        the time zone, must not be {@code null}
+     * @return true if the <code>File</code> exists and has been modified
+     * after the given <code>LocalDateTime</code> at the given 
<code>ZoneId</code>.
+     * @throws IllegalArgumentException if the file, local date time or zone 
ID is {@code null}
+     */
+    public static boolean isFileNewer(final File file, final LocalDateTime 
localDateTime, final ZoneId zoneId) {

Review comment:
       Actually, those classes implement the `ChronoLocalDate` interface, so 
I'll use that instead.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 458455)
    Time Spent: 2h  (was: 1h 50m)

> Add isFileNewer() and isFileOlder() methods that support the Java 8 Date/Time 
> API.
> ----------------------------------------------------------------------------------
>
>                 Key: IO-676
>                 URL: https://issues.apache.org/jira/browse/IO-676
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>            Reporter: Isira Seneviratne
>            Priority: Major
>             Fix For: 2.8
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to