@oliverio als mit klassen bin ich erst vor kurzen dahinter gestiegen und versuche mich daran. sollte aber so passen. hab das von oberen Post heraus kopiert.
warum ist eigentlich bei module.exports = { Buch } in den klammern, genauso wie bein const { Buch } =?
class Buch {
constructor(adapter) {
this.adapter = adapter
}
getCurrentWeekdayAsString() {
var now = new Date()
let weekday = now.getDay()
/*this.adapter.sendTo("email.0", {
from: "uwe.clement@gmail.com",
to: "uwe.clement@gmail.com",
subject: "Test1",
html: "test2"
})*/
return this.getWeekdayAsString(weekday)
}
getWeekdayAsString(weekday) {
let weekdayAsString
if (weekday == 1) {
weekdayAsString = "Montag"
} else if (weekday == 2) {
weekdayAsString = "Dienstag"
} else if (weekday == 3) {
weekdayAsString = "Mittwoch"
} else if (weekday == 4) {
weekdayAsString = "Donnerstag"
} else if (weekday == 5) {
weekdayAsString = "Freitag"
} else if (weekday == 6) {
weekdayAsString = "Samstag"
} else if (weekday == 7) {
weekdayAsString = "Sonntag"
} else if (weekday == 0) {
weekdayAsString = "Sonntag"
}
return weekdayAsString
}
}
module.exports = { Buch }