mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
e82c8c52c5
commit
f12de13813
@ -45,6 +45,7 @@
|
|||||||
* 【poi 】 修复CellUtil.setCellValuestyle空导致值无法写入问题(issue#1995@Github)
|
* 【poi 】 修复CellUtil.setCellValuestyle空导致值无法写入问题(issue#1995@Github)
|
||||||
* 【poi 】 修复CellUtil.setComment参数设置错误问题
|
* 【poi 】 修复CellUtil.setComment参数设置错误问题
|
||||||
* 【core 】 修复QueryBuilder解析路径导致的错误(issue#1989@Github)
|
* 【core 】 修复QueryBuilder解析路径导致的错误(issue#1989@Github)
|
||||||
|
* 【core 】 修复DateTime.between中DateUnit无效问题
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -10,14 +10,17 @@ import java.util.Date;
|
|||||||
* 日期间隔
|
* 日期间隔
|
||||||
*
|
*
|
||||||
* @author Looly
|
* @author Looly
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DateBetween implements Serializable {
|
public class DateBetween implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 开始日期 */
|
/**
|
||||||
|
* 开始日期
|
||||||
|
*/
|
||||||
private final Date begin;
|
private final Date begin;
|
||||||
/** 结束日期 */
|
/**
|
||||||
|
* 结束日期
|
||||||
|
*/
|
||||||
private final Date end;
|
private final Date end;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,13 +157,25 @@ public class DateBetween implements Serializable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化输出时间差<br>
|
* 格式化输出时间差
|
||||||
|
*
|
||||||
|
* @param unit 日期单位
|
||||||
|
* @param level 级别
|
||||||
|
* @return 字符串
|
||||||
|
* @since 5.7.17
|
||||||
|
*/
|
||||||
|
public String toString(DateUnit unit, BetweenFormatter.Level level) {
|
||||||
|
return DateUtil.formatBetween(between(unit), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化输出时间差
|
||||||
*
|
*
|
||||||
* @param level 级别
|
* @param level 级别
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public String toString(BetweenFormatter.Level level) {
|
public String toString(BetweenFormatter.Level level) {
|
||||||
return DateUtil.formatBetween(between(DateUnit.MS), level);
|
return toString(DateUnit.MS, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -743,7 +743,7 @@ public class DateTime extends Date {
|
|||||||
* @return 相差时长
|
* @return 相差时长
|
||||||
*/
|
*/
|
||||||
public String between(Date date, DateUnit unit, BetweenFormatter.Level formatLevel) {
|
public String between(Date date, DateUnit unit, BetweenFormatter.Level formatLevel) {
|
||||||
return new DateBetween(this, date).toString(formatLevel);
|
return new DateBetween(this, date).toString(unit, formatLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user