mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
change name to DateFormatManager
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package org.dromara.hutool.json.jwt;
|
||||
|
||||
import org.dromara.hutool.core.codec.binary.Base64;
|
||||
import org.dromara.hutool.core.date.format.GlobalCustomFormat;
|
||||
import org.dromara.hutool.core.date.format.DateFormatManager;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.json.JSONConfig;
|
||||
@@ -38,7 +38,7 @@ public class Claims implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 时间使用秒级时间戳表示
|
||||
private final JSONConfig CONFIG = JSONConfig.of().setDateFormat(GlobalCustomFormat.FORMAT_SECONDS);
|
||||
private final JSONConfig CONFIG = JSONConfig.of().setDateFormat(DateFormatManager.FORMAT_SECONDS);
|
||||
|
||||
private JSONObject claimJSON;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ package org.dromara.hutool.json.serializer.impl;
|
||||
|
||||
import org.dromara.hutool.core.convert.impl.DateConverter;
|
||||
import org.dromara.hutool.core.date.DateUtil;
|
||||
import org.dromara.hutool.core.date.format.GlobalCustomFormat;
|
||||
import org.dromara.hutool.core.date.format.DateFormatManager;
|
||||
import org.dromara.hutool.core.reflect.TypeUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import org.dromara.hutool.json.JSON;
|
||||
@@ -61,9 +61,9 @@ public class DateTypeAdapter implements MatcherJSONSerializer<Date>, MatcherJSON
|
||||
|
||||
final Object value;
|
||||
// 默认为时间戳
|
||||
if(null == format || GlobalCustomFormat.FORMAT_MILLISECONDS.equals(format)){
|
||||
if(null == format || DateFormatManager.FORMAT_MILLISECONDS.equals(format)){
|
||||
value = bean.getTime();
|
||||
} else if(GlobalCustomFormat.FORMAT_SECONDS.equals(format)){
|
||||
} else if(DateFormatManager.FORMAT_SECONDS.equals(format)){
|
||||
value = Math.floorDiv(bean.getTime(), 1000L);
|
||||
} else {
|
||||
value = DateUtil.format(bean, format);
|
||||
|
@@ -18,7 +18,7 @@ package org.dromara.hutool.json.serializer.impl;
|
||||
|
||||
import org.dromara.hutool.core.convert.impl.TemporalAccessorConverter;
|
||||
import org.dromara.hutool.core.date.TimeUtil;
|
||||
import org.dromara.hutool.core.date.format.GlobalCustomFormat;
|
||||
import org.dromara.hutool.core.date.format.DateFormatManager;
|
||||
import org.dromara.hutool.core.lang.Assert;
|
||||
import org.dromara.hutool.core.lang.Opt;
|
||||
import org.dromara.hutool.core.math.NumberUtil;
|
||||
@@ -90,9 +90,9 @@ public class TemporalTypeAdapter implements MatcherJSONSerializer<TemporalAccess
|
||||
|
||||
final Object value;
|
||||
// 默认为时间戳
|
||||
if (null == format || GlobalCustomFormat.FORMAT_MILLISECONDS.equals(format)) {
|
||||
if (null == format || DateFormatManager.FORMAT_MILLISECONDS.equals(format)) {
|
||||
value = TimeUtil.toEpochMilli(bean);
|
||||
} else if (GlobalCustomFormat.FORMAT_SECONDS.equals(format)) {
|
||||
} else if (DateFormatManager.FORMAT_SECONDS.equals(format)) {
|
||||
value = Math.floorDiv(TimeUtil.toEpochMilli(bean), 1000L);
|
||||
} else {
|
||||
value = TimeUtil.format(bean, format);
|
||||
|
Reference in New Issue
Block a user