Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mds92 committed Sep 13, 2020
1 parent 0da2550 commit 3c8cd10
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
2 changes: 2 additions & 0 deletions demo/Samples1.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ <h3>Multiple Months</h3>
</div>
<input type="text" id="inputDate3" class="form-control" placeholder="DateTimePicker With Multiple Month"
aria-label="date3" aria-describedby="date3" value="1397/02/01">
<input type="hidden" id="inputDate3-11">
</div>
</div>
<div class="col-sm-6">
Expand Down Expand Up @@ -253,6 +254,7 @@ <h3>InLine</h3>

$('#date3').MdPersianDateTimePicker({
targetTextSelector: '#inputDate3',
targetDateSelector: '#inputDate3-11',
monthsToShow: [1, 1],
});
$('#date3-1').MdPersianDateTimePicker({
Expand Down
3 changes: 2 additions & 1 deletion demo/SamplesToDebug.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ <h2>Simple</h2>
targetTextSelector: "#showDate_class",
textFormat: " dddd dd MMMM yyyy ",
isGregorian: false,
modalMode: true
modalMode: false,
englishNumber: false
});
});
</script>
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
"homepage": "https://github.com/Mds92/MD.BootstrapPersianDateTimePicker",
"dependencies": {
"@popperjs/core": "^2.4.4",
"bootstrap": "^4.5.0",
"bootstrap": "^4.5.2",
"jquery": "^3.4.1",
"npm": "^6.14.6"
"npm": "^6.14.8"
},
"devDependencies": {
"@types/jquery": "^3.5.0",
"@types/jquery": "^3.5.1",
"css-loader": "^1.0.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"jshint": "^2.11.1",
"jshint": "^2.12.0",
"jshint-loader": "^0.8.4",
"mini-css-extract-plugin": "^0.4.5",
"style-loader": "^0.23.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.40.2",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-fix-style-only-entries": "0.0.4",
Expand Down
22 changes: 14 additions & 8 deletions src/jquery.md.bootstrap.datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,23 @@
function getSelectedDateTimeTextFormatted(setting) {
if (setting.selectedDate == undefined) return '';
if (setting.rangeSelector && setting.rangeSelectorStartDate != undefined && setting.rangeSelectorEndDate != undefined)
return getDateTimeString(!setting.isGregorian ? getDateTimeJsonPersian1(setting.rangeSelectorStartDate) : getDateTimeJson1(setting.rangeSelectorStartDate), setting.textFormat, setting.isGregorian, setting.englishNumber) + ' - ' +
getDateTimeString(!setting.isGregorian ? getDateTimeJsonPersian1(setting.rangeSelectorEndDate) : getDateTimeJson1(setting.rangeSelectorEndDate), setting.textFormat, setting.isGregorian, setting.englishNumber);
return getDateTimeString(!setting.isGregorian ? getDateTimeJsonPersian1(setting.selectedDate) : getDateTimeJson1(setting.selectedDate), setting.textFormat, setting.isGregorian, setting.englishNumber);
return getDateTimeString(!setting.isGregorian
? getDateTimeJsonPersian1(setting.rangeSelectorStartDate)
: getDateTimeJson1(setting.rangeSelectorStartDate), setting.textFormat, setting.isGregorian, setting.englishNumber) + ' - ' +
getDateTimeString(!setting.isGregorian
? getDateTimeJsonPersian1(setting.rangeSelectorEndDate)
: getDateTimeJson1(setting.rangeSelectorEndDate), setting.textFormat, setting.isGregorian, setting.englishNumber);
return getDateTimeString(!setting.isGregorian
? getDateTimeJsonPersian1(setting.selectedDate)
: getDateTimeJson1(setting.selectedDate), setting.textFormat, setting.isGregorian, setting.englishNumber);
}

function getSelectedDateTimeFormatted(setting) {
if (setting.selectedDate == undefined) return '';
if (setting.rangeSelector && setting.rangeSelectorStartDate != undefined && setting.rangeSelectorEndDate != undefined)
return getDateTimeString(getDateTimeJson1(setting.rangeSelectorStartDate), setting.dateFormat, setting.isGregorian, true) + ' - ' +
getDateTimeString(getDateTimeJson1(setting.rangeSelectorEndDate), setting.dateFormat, setting.isGregorian, true);
return getDateTimeString(getDateTimeJson1(setting.selectedDate), setting.dateFormat, setting.isGregorian, true);
return getDateTimeString(getDateTimeJson1(setting.rangeSelectorStartDate), setting.dateFormat, setting.isGregorian, setting.englishNumber) + ' - ' +
getDateTimeString(getDateTimeJson1(setting.rangeSelectorEndDate), setting.dateFormat, setting.isGregorian, setting.englishNumber);
return getDateTimeString(getDateTimeJson1(setting.selectedDate), setting.dateFormat, setting.isGregorian, setting.englishNumber);
}

function setSelectedData(setting) {
Expand All @@ -560,12 +566,12 @@
if ($targetDate.length > 0) {
switch ($targetDate[0].tagName.toLowerCase()) {
case 'input':
$targetDate.val(getSelectedDateTimeFormatted(setting));
$targetDate.val(toEnglishNumber(getSelectedDateTimeFormatted(setting)));
triggerChangeCalling = true;
$targetDate.trigger('change');
break;
default:
$targetDate.text(getSelectedDateTimeFormatted(setting));
$targetDate.text(toEnglishNumber(getSelectedDateTimeFormatted(setting)));
triggerChangeCalling = true;
$targetDate.trigger('change');
break;
Expand Down

0 comments on commit 3c8cd10

Please sign in to comment.