@@ -2611,6 +2611,22 @@ pub fn render_new_card_form(rect: &mut Frame, app: &mut App, popup_mode: bool) {
26112611 )
26122612 . split ( rect. size ( ) ) ;
26132613
2614+ let card_due_date = app. widgets . date_time_picker . get_date_time_as_string ( app. config . date_time_format ) ;
2615+
2616+ if app. state . z_stack . last ( ) == Some ( & PopupMode :: DateTimePicker ) {
2617+ if app. widgets . date_time_picker . anchor . is_none ( ) {
2618+ app. widgets . date_time_picker . anchor = Some ( (
2619+ chunks[ 3 ] . x + card_due_date. len ( ) as u16 + 2 ,
2620+ chunks[ 3 ] . y + 3 ,
2621+ ) ) ; // offsets to make sure date is visible
2622+ debug ! (
2623+ "Setting anchor for date time picker to: {:?}" ,
2624+ app. widgets. date_time_picker. anchor
2625+ ) ;
2626+ }
2627+ app. widgets . date_time_picker . current_viewport = Some ( rect. size ( ) ) ;
2628+ }
2629+
26142630 let general_style = check_for_popup_and_get_style (
26152631 popup_mode,
26162632 app. current_theme . inactive_text_style ,
@@ -7907,15 +7923,16 @@ pub fn render_date_time_widget(rect: &mut Frame, app: &mut App, popup_mode: bool
79077923
79087924 app. widgets . date_time_picker . current_render_area = Some ( render_area) ;
79097925
7910- let title_length = ( current_month. len ( ) + 3 + current_year. len ( ) ) as u16 ; // 3 is for the " - "
7926+ let title_length = ( current_month. len ( ) + 3 + current_year. len ( ) + 4 ) as u16 ; // 3 is for the " - ",
7927+ // additional 4 is to compensate for the borders that show when focus is on month or year
79117928 let padding = ( render_area
79127929 . width
79137930 . min ( app. widgets . date_time_picker . date_target_width )
79147931 - 3
79157932 - 2 )
79167933 . saturating_sub ( title_length) ; // 3 is for the Time section expand button, 2 is for margin
7917- let month_length = current_month. len ( ) as u16 + ( padding / 2 ) ;
7918- let year_length = current_year. len ( ) as u16 + ( padding / 2 ) ;
7934+ let month_length = current_month. len ( ) as u16 + ( padding / 2 ) + 2 ;
7935+ let year_length = current_year. len ( ) as u16 + ( padding / 2 ) + 2 ;
79197936
79207937 let ( date_picker_render_area, time_picker_render_area) =
79217938 if app. widgets . date_time_picker . widget_width
0 commit comments