I found that only some years on December 29th, 30th, and 31st, are these years incorrect.
Here is my test mapping function I setup to isolate when the issue occurs by picking 10000 random dates, and only printing ones that didn't match:
function testFormatDate(date) {
var formattedDate = qie.formatDate('YYYY-MM-dd', date);
if (!StringUtils.equals(date, formattedDate)) {
qie.warn(date + " was formatted into: " + formattedDate);
}
}
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomDateString (minLong, maxLong) {
var date = new java.util.Date(getRandomInt(minLong, maxLong));
var sdf = new java.text.SimpleDateFormat('YYYY-MM-dd');
return sdf.format(date);
}
function getDateLong(dateString) {
return qie.deduceDate(dateString).getTime();
}
var minLong = getDateLong('2000-01-01');
var maxLong = getDateLong('2020-01-01');
for (var i = 0; i < 100000; i++) {
testFormatDate(getRandomDateString(minLong, maxLong));
}