Browse Source

Pull request #8604: REPORT-69887【日期控件专项优化】日期控件的格式设置为yyMMdd或yyMM时,前端显示不对

Merge in DESIGN/design from ~LUCIAN.CHEN/design:feature/x to feature/x

* commit 'b99e8ac96520e6e53ca09d02990a14edd924952e':
  REPORT-69887【日期控件专项优化】日期控件的格式设置为yyMMdd或yyMM时,前端显示不对
feature/x
Lucian.Chen 3 years ago
parent
commit
a270c81dfc
  1. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java
  2. 27
      designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheck.java

@ -62,8 +62,7 @@ public class DateFormatFrontCheck implements DateFormatCheck {
}
private boolean isSpecialFmt(String fmt) {
String lowerFmt = fmt.toLowerCase();
return AssistUtils.equals(lowerFmt, "%y%x") || AssistUtils.equals(lowerFmt, "%y%x%d");
return AssistUtils.equals(fmt, "%Y%X") || AssistUtils.equals(fmt, "%Y%X%d");
}
private String parseFmt(String fmt) {

27
designer-form/src/test/java/com/fr/design/widget/ui/designer/date/check/DateFormatFrontCheckTest.java

@ -0,0 +1,27 @@
package com.fr.design.widget.ui.designer.date.check;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2022/4/18
*/
public class DateFormatFrontCheckTest {
@Test
public void testAccept() {
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("20220101", "yyyyMMdd"));
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("202201", "yyyyMM"));
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022-01-01", "yyyy-MM-dd"));
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("22/01/01", "yy/MM/dd"));
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022年01月01日", "yyyy年MM月dd日"));
Assert.assertTrue(DateFormatFrontCheck.KEY.accept("2022/01/01 12:30:00", "yyyy/MM/dd HH:mm:ss"));
Assert.assertFalse(DateFormatFrontCheck.KEY.accept("220101", "yyMMdd"));
Assert.assertFalse(DateFormatFrontCheck.KEY.accept("20221", "yyyyM"));
Assert.assertFalse(DateFormatFrontCheck.KEY.accept("20220101123000", "yyyyMMddHHmmss"));
Assert.assertFalse(DateFormatFrontCheck.KEY.accept("2022-01-01", "YYYY-MM-dd"));
}
}
Loading…
Cancel
Save