package jfdi.parser;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.joestelmach.natty.DateGroup;
import com.joestelmach.natty.Parser;

public class DateTimeParser {
    private static DateTimeParser dateTimeParser;

    public static DateTimeParser getInstance() {
        return (dateTimeParser == null) ? dateTimeParser = new DateTimeParser()
                : dateTimeParser;
    }

    public List<LocalDateTime> parseDateTime(String input) {
        Parser parser = new Parser();
        List<DateGroup> dateTimeList = parser.parse(input);
        List<LocalDateTime> ldtList = new ArrayList<LocalDateTime>();
        for (DateGroup g : dateTimeList) {
            List<Date> dates = g.getDates();
            dates.forEach((date) -> ldtList.add(getLocalDateTimeFromDate(date)));
        }

        ldtList.forEach(System.out::println);
        return ldtList;
    }

    public LocalDateTime getLocalDateTimeFromDate(Date d) {
        return LocalDateTime.ofInstant(d.toInstant(), Constants.ZONE_ID);
    }

}

@@ -204,258 +204,1105 @@
 r;%0A%0A
-public class DateTimeParser %7B%0A    private static DateTimeParser dateTimeParser;%0A%0A    public static DateTimeParser getInstance() %7B%0A        return (dateTimeParser == null) ? dateTimeParser = new DateTimeParser()%0A                : dateTimeParser;%0A    %7D%0A
+/**%0A * DateTimeParser is a class used to parse a string input into one a list of%0A * LocalDateTime objects it represents. It supports parsing strings of different%0A * formats. For example, it can parse %22by 23rd February 2015%22 or %22from 23/02/15%0A * 2359hrs to 29/03/16 09:40pm%22. For an idea of the format of String parseable,%0A * see parser.Constants.java.%0A *%0A * @author Leonard Hio%0A *%0A */%0Apublic class DateTimeParser %7B%0A    private static DateTimeParser dateTimeParser;%0A%0A    public static DateTimeParser getInstance() %7B%0A        return (dateTimeParser == null) ? dateTimeParser = new DateTimeParser()%0A                : dateTimeParser;%0A    %7D%0A%0A    /**%0A     * This method parses the given input string into a list of LocalDateTime%0A     * objects.%0A     *%0A     * @param input%0A     *            a string that should match the date-time format listed in%0A     *            parser.Constants.java.%0A     * @return a list of localDateTime objects, parsed from the input string.%0A     *         The list can be of size 0, which indicates the input string%0A     *         contains no parseable date time String.%0A     */
 %0A   
@@ -1781,24 +1781,303 @@
 ist;%0A    %7D%0A%0A
+    /**%0A     * This method reformats a given Date object to a LocalDateTime object. The%0A     * zone is taken to be the one found in the system.%0A     *%0A     * @param d%0A     *            a Date object%0A     * @return the LocalDateTime object formatted from the Date object.%0A     */%0A
     public L

Comment DateTimeParser