File tree Expand file tree Collapse file tree 1 file changed +8
-18
lines changed Expand file tree Collapse file tree 1 file changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -112,26 +112,15 @@ def input_date(
112112    """ 
113113
114114    resolved_id  =  resolve_id (id )
115- 
116-     def  process_date (d : Optional [date  |  str ]) ->  Optional [str ]:
117-         if  d  is  None :
118-             return  None 
119-         if  isinstance (d , date ):
120-             return  d .strftime ("%Y-%m-%d" )
121-         if  isinstance (d , str ):
122-             return  d 
123- 
124-     min_dt  =  process_date (min )
125-     max_dt  =  process_date (max )
126-     default_value  =  process_date (value )
115+     default_value  =  value  if  value  is  not None  else  date .today ()
127116
128117    return  div (
129118        shiny_input_label (resolved_id , label ),
130119        _date_input_tag (
131120            id = resolved_id ,
132121            value = restore_input (resolved_id , default_value ),
133-             min = min_dt ,
134-             max = max_dt ,
122+             min = min ,
123+             max = max ,
135124            format = format ,
136125            startview = startview ,
137126            weekstart = weekstart ,
@@ -321,8 +310,9 @@ def _date_input_tag(
321310def  _as_date_attr (x : Optional [date  |  str ]) ->  Optional [str ]:
322311    if  x  is  None :
323312        return  None 
324-     if  isinstance (x , date ):
325-         return  str (x )
326313    if  isinstance (x , str ):
327-         return  x 
328-     return  str (date .fromisoformat (x ))
314+         if  len (x ) ==  0 :
315+             return  x 
316+         x  =  date .fromisoformat (x )
317+ 
318+     return  x .isoformat ()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments