dayjs-module
dayjs-module copied to clipboard
Registering a local plugin
I have defined a plugin to add a function to the $dayjs() object:
// plugins/dayjs.js
export default (option, dayjsClass) => {
dayjsClass.prototype.addWeekdays = function (numDays) {
const direction = numDays < 0 ? -1 : 1
let date = this
while (numDays !== 0) {
date = date.addDays(direction)
if (date.day() !== 0 && date.day() !== 6) {
numDays -= direction
}
}
return date
}
}
However, when using the plugins setting plugins: ['~/plugins/dayjs.js'] the module cannot be found because it looks within 'dayjs/plugin/~/plugins/dayjs`