Skip to content

Commit 3339539

Browse files
committed
CLDR-17851 update per review comments
- roll by 2 days instead of one
1 parent 9f1c860 commit 3339539

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,12 +3144,13 @@ private void handleEras(XPathParts parts, String value, List<String> examples) {
31443144
if (startCal == null && prevEra != null && prevEra.getEnd() != null) {
31453145
startCal = prevEra.getEndCalendar();
31463146
// shift forward so we are in the next era
3147-
startCal.setTimeInMillis(startCal.getTimeInMillis() + (DateConstants.MILLIS_PER_DAY));
3147+
startCal.setTimeInMillis(
3148+
startCal.getTimeInMillis() + DateConstants.MILLIS_PER_TWO_DAYS);
31483149
}
31493150
if (endCal == null && nextEra != null && nextEra.getStart() != null) {
31503151
endCal = nextEra.getStartCalendar();
31513152
// shift backward so we are in the prev era
3152-
endCal.setTimeInMillis(endCal.getTimeInMillis() - (DateConstants.MILLIS_PER_DAY));
3153+
endCal.setTimeInMillis(endCal.getTimeInMillis() - DateConstants.MILLIS_PER_TWO_DAYS);
31533154
}
31543155

31553156
GregorianCalendar sampleDate = null;
@@ -3158,18 +3159,18 @@ private void handleEras(XPathParts parts, String value, List<String> examples) {
31583159
// roll back a day to not hit the edge
31593160
sampleDate = endCal;
31603161
sampleDate.setTimeInMillis(
3161-
sampleDate.getTimeInMillis() - (DateConstants.MILLIS_PER_DAY));
3162+
sampleDate.getTimeInMillis() - DateConstants.MILLIS_PER_TWO_DAYS);
31623163
} else if (startCal == null && endCal != null) {
31633164
// roll back a day to not hit the edge
31643165
sampleDate = endCal;
31653166
sampleDate.setTimeInMillis(
3166-
sampleDate.getTimeInMillis() - (DateConstants.MILLIS_PER_DAY));
3167+
sampleDate.getTimeInMillis() - DateConstants.MILLIS_PER_TWO_DAYS);
31673168
} else if (startCal != null && endCal == null) {
31683169
sampleDate = new GregorianCalendar(2002, 6, 15); // CLDR repo root commit
31693170
if (sampleDate.before(startCal)) {
31703171
sampleDate = startCal;
31713172
sampleDate.setTimeInMillis(
3172-
sampleDate.getTimeInMillis() + (DateConstants.MILLIS_PER_DAY));
3173+
sampleDate.getTimeInMillis() + DateConstants.MILLIS_PER_TWO_DAYS);
31733174
}
31743175
} else {
31753176
// System.err.println("No good date for " + eraData);

tools/cldr-code/src/main/java/org/unicode/cldr/util/DateConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class DateConstants {
1515
public static final long MILLIS_PER_MINUTE = MILLIS_PER_SECOND * 60;
1616
public static final long MILLIS_PER_HOUR = MILLIS_PER_MINUTE * 60;
1717
public static final long MILLIS_PER_DAY = MILLIS_PER_HOUR * 24;
18+
public static final long MILLIS_PER_TWO_DAYS = 2 * MILLIS_PER_DAY;
1819
public static final long MILLIS_PER_MONTH = MILLIS_PER_DAY * 30;
1920

2021
private static final Date getRecentHistory(Date d) {

0 commit comments

Comments
 (0)