Warning related to ISODate pattern YYYY

_/2019-12-31 taken from jPOS' Slack/

_from @Gandhi

Hi there!

We found ourselves in a weird situation with ISODate.formatDate.

After 2019-12-29 (this weekend), some problems with ICC validation rised from nothing (no changes made in the prod environment).

It happens that dates formatted with pattern YYMMdd were presented as 201229.

Don't know if you were aware of that kind of stuff or if it's documented somewhere, but it would easily corrected using another pattern. (all code comments uses "YY" as example)

It would help too, if ISODate has in it's comments and docs what patterns should be better to be used. I know that's more a missuse case, but if our mistakes can help someone to prevent theirs... it's a good thing right?Here's a code as example/demonstration:

import java.util.Date;
import org.jpos.iso.ISODate;

public class TesteISODate {	
  public static void main(String[] args) {
	  String[] ptt = {"YYMMdd", "yyMMdd"};
	  String[] strdate = {"20191228000000", "20191229000000"};		
    for (String dtStr : strdate) {
	    for (String pttStr : ptt) {
	  			System.out.println(TesteISODate.getOutStr(pttStr, dtStr));
  		}
  	}	
  }	
                           
  private static String getOutStr(String ptt, String strdate) {
		Date dtin = ISODate.parseISODate(strdate);
    return "Using pattern: " + ptt + " and Date for " + strdate + ": "
      + ISODate.formatDate(dtin, ptt);
	}
}

Then Relevant tweet provided by @Soares

PSA: TIS THE SEASON TO CHECK YOUR FORMATTERS, PEOPLETIL that Java's DateTimeFormatter pattern "YYYY" gives you the week-based-year, (by default, ISO-8601 standard) the year of the Thursday of that week.12/29/2019 formats to 2019 12/30/2019 formats to 2020