Skip to content

Commit 6db45f7

Browse files
committed
support 'w' as suffix for time format
1 parent 1f58a26 commit 6db45f7

File tree

1 file changed

+2
-0
lines changed
  • modules/elasticsearch/src/main/java/org/elasticsearch/common/unit

1 file changed

+2
-0
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/common/unit/TimeValue.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ public static TimeValue parseTimeValue(String sValue, TimeValue defaultValue) {
235235
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 60 * 60 * 1000);
236236
} else if (sValue.endsWith("d")) {
237237
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 24 * 60 * 60 * 1000);
238+
} else if (sValue.endsWith("w")) {
239+
millis = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * 7 * 24 * 60 * 60 * 1000);
238240
} else {
239241
millis = Long.parseLong(sValue);
240242
}

0 commit comments

Comments
 (0)