版博士V2.0程序
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

29 rader
588 B

  1. 'use strict';
  2. const DatePart = require('./datepart');
  3. class Milliseconds extends DatePart {
  4. constructor(opts={}) {
  5. super(opts);
  6. }
  7. up() {
  8. this.date.setMilliseconds(this.date.getMilliseconds() + 1);
  9. }
  10. down() {
  11. this.date.setMilliseconds(this.date.getMilliseconds() - 1);
  12. }
  13. setTo(val) {
  14. this.date.setMilliseconds(parseInt(val.substr(-(this.token.length))));
  15. }
  16. toString() {
  17. return String(this.date.getMilliseconds()).padStart(4, '0')
  18. .substr(0, this.token.length);
  19. }
  20. }
  21. module.exports = Milliseconds;