Skip to content

Commit

Permalink
fix(project): add polyfills and use ie11 compatible function (sumcumo#25
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MrWook authored Aug 12, 2020
1 parent c9e0153 commit 523bccd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
</div>
</template>
<script>
import '~/utils/polyfills'
import en from '~/locale/translations/en'
import { makeDateUtils } from '~/utils/DateUtils'
import DateInput from '~/components/DateInput'
Expand Down
20 changes: 18 additions & 2 deletions src/locale/Language.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,28 @@ export default class Language {
}

getMonthByAbbrName(name) {
const monthValue = this._monthsAbbr.findIndex((month) => month === name) + 1
let index = -1
this._monthsAbbr.some((month, i) => {
if (month === name) {
index = i
return true
}
return false
})
const monthValue = index + 1
return monthValue < 10 ? `0${monthValue}` : `${monthValue}`
}

getMonthByName(name) {
const monthValue = this._months.findIndex((month) => month === name) + 1
let index = -1
this._months.some((month, i) => {
if (month === name) {
index = i
return true
}
return false
})
const monthValue = index + 1
return monthValue < 10 ? `0${monthValue}` : `${monthValue}`
}
}
2 changes: 2 additions & 0 deletions src/utils/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'core-js/es/object/assign'
import 'core-js/es/number/is-nan'

0 comments on commit 523bccd

Please sign in to comment.