mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix http
This commit is contained in:
@@ -268,6 +268,10 @@ public class DateTime extends Date {
|
||||
* @return 如果此对象为可变对象,返回自身,否则返回新对象
|
||||
*/
|
||||
public DateTime offset(DateField datePart, int offset) {
|
||||
if(DateField.ERA == datePart){
|
||||
throw new IllegalArgumentException("ERA is not support offset!");
|
||||
}
|
||||
|
||||
final Calendar cal = toCalendar();
|
||||
//noinspection MagicConstant
|
||||
cal.add(datePart.getValue(), offset);
|
||||
|
@@ -645,6 +645,7 @@ public class DateUtilTest {
|
||||
DateTime startDate = DateUtil.parse("2019-12-01 17:02:30");
|
||||
DateTime endDate = DateUtil.parse("2019-12-02 17:02:30");
|
||||
int length = 3;
|
||||
//noinspection deprecation
|
||||
boolean expired = DateUtil.isExpired(startDate, DateField.DAY_OF_YEAR, length, endDate);
|
||||
Assert.assertTrue(expired);
|
||||
}
|
||||
|
Reference in New Issue
Block a user