From 226b4cc0ba305a2a9be1edd3eeabbedaf4dd41ca Mon Sep 17 00:00:00 2001 From: Amiel Elboim Date: Tue, 12 Dec 2017 16:01:00 +0200 Subject: [PATCH] Patch in the datepicker popup for RTL languages --- library/js/xl/jquery-datetimepicker-2-5-4.js.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/library/js/xl/jquery-datetimepicker-2-5-4.js.php b/library/js/xl/jquery-datetimepicker-2-5-4.js.php index 719d1ace6..dd0c1d15f 100644 --- a/library/js/xl/jquery-datetimepicker-2-5-4.js.php +++ b/library/js/xl/jquery-datetimepicker-2-5-4.js.php @@ -59,6 +59,25 @@ ] }, }, + + /** + * In RTL languages a datepicker popup is opened in left and it's cutted by the edge of the window + * This patch resolves that and moves a datepicker popup to right side. + */ + onGenerate:function(current_time,$input){ + //position of input + var position = $($input).offset() + //width of date picke popup + var datepickerPopupWidth = $('.xdsoft_datetimepicker').width(); + + if(position.left < datepickerPopupWidth){ + $('.xdsoft_datetimepicker').offset({left:position.left}); + } else { + //put a popup in the regular position + $('.xdsoft_datetimepicker').offset({left:position.left - datepickerPopupWidth + $($input).innerWidth()}); + } + }, + yearStart: '1900', scrollInput: false, scrollMonth: false, -- 2.11.4.GIT