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.

datepart.js 681B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. class DatePart {
  3. constructor({token, date, parts, locales}) {
  4. this.token = token;
  5. this.date = date || new Date();
  6. this.parts = parts || [this];
  7. this.locales = locales || {};
  8. }
  9. up() {}
  10. down() {}
  11. next() {
  12. const currentIdx = this.parts.indexOf(this);
  13. return this.parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
  14. }
  15. setTo(val) {}
  16. prev() {
  17. let parts = [].concat(this.parts).reverse();
  18. const currentIdx = parts.indexOf(this);
  19. return parts.find((part, idx) => idx > currentIdx && part instanceof DatePart);
  20. }
  21. toString() {
  22. return String(this.date);
  23. }
  24. }
  25. module.exports = DatePart;