Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

month.js 685B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. const DatePart = require('./datepart');
  3. class Month extends DatePart {
  4. constructor(opts={}) {
  5. super(opts);
  6. }
  7. up() {
  8. this.date.setMonth(this.date.getMonth() + 1);
  9. }
  10. down() {
  11. this.date.setMonth(this.date.getMonth() - 1);
  12. }
  13. setTo(val) {
  14. val = parseInt(val.substr(-2)) - 1;
  15. this.date.setMonth(val < 0 ? 0 : val);
  16. }
  17. toString() {
  18. let month = this.date.getMonth();
  19. let tl = this.token.length;
  20. return tl === 2 ? String(month + 1).padStart(2, '0')
  21. : tl === 3 ? this.locales.monthsShort[month]
  22. : tl === 4 ? this.locales.months[month]
  23. : String(month + 1);
  24. }
  25. }
  26. module.exports = Month;