|
81 | 81 | <transition name="slideY"> |
82 | 82 | <span :key="selectedDate.xYear()"> |
83 | 83 | <slot name="header-year" v-bind="{ vm, selectedDate }"> |
84 | | - {{ selectedDate.xYear() }} |
| 84 | + {{ convertToLocaleNumber(selectedDate.xYear()) }} |
85 | 85 | </slot> |
86 | 86 | </span> |
87 | 87 | </transition> |
|
94 | 94 | <transition name="slideY"> |
95 | 95 | <span :key="formattedDate"> |
96 | 96 | <slot name="header-date" v-bind="{ vm, formattedDate }"> |
97 | | - {{ formattedDate }} |
| 97 | + {{ convertToLocaleNumber(formattedDate) }} |
98 | 98 | </slot> |
99 | 99 | </span> |
100 | 100 | </transition> |
|
153 | 153 | <slot name="month-name" v-bind="{ vm, date, color }"> |
154 | 154 | <span |
155 | 155 | :style="{ 'border-color': color, color }" |
156 | | - v-text="date.xFormat('jMMMM jYYYY')" |
| 156 | + v-text=" |
| 157 | + convertToLocaleNumber(date.xFormat('jMMMM jYYYY')) |
| 158 | + " |
157 | 159 | /> |
158 | 160 | </slot> |
159 | 161 | </div> |
|
208 | 210 | /> |
209 | 211 | <span |
210 | 212 | :class="[prefix('day-text')]" |
211 | | - v-text="day.formatted" |
| 213 | + v-text="convertToLocaleNumber(day.formatted)" |
212 | 214 | /> |
213 | 215 | </slot> |
214 | 216 | </template> |
|
250 | 252 | @click="selectYear(year)" |
251 | 253 | > |
252 | 254 | <slot name="year-item" v-bind="{ vm, year, color }"> |
253 | | - {{ year.xFormat('jYYYY') }} |
| 255 | + {{ convertToLocaleNumber(year.xFormat('jYYYY')) }} |
254 | 256 | </slot> |
255 | 257 | </div> |
256 | 258 | </div> |
@@ -775,7 +777,13 @@ export default { |
775 | 777 | * @default true |
776 | 778 | * @version 2.1.6 |
777 | 779 | */ |
778 | | - showNowBtn: { type: Boolean, default: true } |
| 780 | + showNowBtn: { type: Boolean, default: true }, |
| 781 | + /** |
| 782 | + * Convert to locale numbers or not |
| 783 | + * @type Boolean |
| 784 | + * @default false |
| 785 | + */ |
| 786 | + convertNumbers: { type: Boolean, default: false } |
779 | 787 | }, |
780 | 788 | data() { |
781 | 789 | let defaultLocale = this.locale.split(',')[0] |
@@ -1050,7 +1058,7 @@ export default { |
1050 | 1058 | let output = this.output.clone() |
1051 | 1059 | let format = this.selfDisplayFormat |
1052 | 1060 | if (/j\w/.test(format)) output.locale('fa') |
1053 | | - return output.format(format) |
| 1061 | + return this.convertToLocaleNumber(output.format(format)) |
1054 | 1062 | }, |
1055 | 1063 | isDisableTime() { |
1056 | 1064 | return this.hasStep('t') && this.checkDisable('t', this.time) |
@@ -1578,6 +1586,18 @@ export default { |
1578 | 1586 | } |
1579 | 1587 | } |
1580 | 1588 | return date.clone() |
| 1589 | + }, |
| 1590 | + convertToLocaleNumber(value) { |
| 1591 | + if (this.convertNumbers && this.locale == 'fa') { |
| 1592 | + return `${value}`.replace(/\d+/g, function(digit) { |
| 1593 | + var ret = '' |
| 1594 | + for (var i = 0, len = digit.length; i < len; i++) { |
| 1595 | + ret += String.fromCharCode(digit.charCodeAt(i) + 1728) |
| 1596 | + } |
| 1597 | + return ret |
| 1598 | + }) |
| 1599 | + } |
| 1600 | + return value |
1581 | 1601 | } |
1582 | 1602 | }, |
1583 | 1603 | install(Vue, options) { |
|
0 commit comments