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.

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. const DatePart = require('./datepart');
  3. class Hours extends DatePart {
  4. constructor(opts={}) {
  5. super(opts);
  6. }
  7. up() {
  8. this.date.setHours(this.date.getHours() + 1);
  9. }
  10. down() {
  11. this.date.setHours(this.date.getHours() - 1);
  12. }
  13. setTo(val) {
  14. this.date.setHours(parseInt(val.substr(-2)));
  15. }
  16. toString() {
  17. let hours = this.date.getHours();
  18. if (/h/.test(this.token))
  19. hours = (hours % 12) || 12;
  20. return this.token.length > 1 ? String(hours).padStart(2, '0') : hours;
  21. }
  22. }
  23. module.exports = Hours;