File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 22
33import { LsmbBaseInput } from "@/elements/lsmb-base-input" ;
44
5+ const dojoDateLocale = require ( "dojo/date/locale" ) ;
56const dojoDateBox = require ( "lsmb/DateTextBox" ) ;
7+ const isoDate = / ^ \d \d \d \d - \d \d - \d \d $ / ;
68
79export class LsmbDate extends LsmbBaseInput {
810 widgetWrapper = null ;
@@ -30,6 +32,22 @@ export class LsmbDate extends LsmbBaseInput {
3032 if ( props . value === "today" ) {
3133 props . value = new Date ( ) ;
3234 }
35+ else if ( typeof props . value === typeof "" ) {
36+ if ( ! isoDate . test ( props . value ) ) {
37+ props . value = dojoDateLocale . parse (
38+ props . value , {
39+ datePattern : "yyyy-MM-dd" ,
40+ selector : "date"
41+ } ) ;
42+ }
43+ else {
44+ props . value = dojoDateLocale . parse (
45+ props . value , {
46+ datePattern : lsmbConfig . dateformat . replace ( / m m / , "MM" ) ,
47+ selector : "date"
48+ } ) ;
49+ }
50+ }
3351 return props ;
3452 }
3553
You can’t perform that action at this time.
0 commit comments