install-nix-action/node_modules/prompts/lib/dateparts/milliseconds.js
Domen Kožar 70742d22d9
v6
2019-11-19 17:50:30 +01:00

28 lines
588 B
JavaScript

'use strict';
const DatePart = require('./datepart');
class Milliseconds extends DatePart {
constructor(opts={}) {
super(opts);
}
up() {
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
}
down() {
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
}
setTo(val) {
this.date.setMilliseconds(parseInt(val.substr(-(this.token.length))));
}
toString() {
return String(this.date.getMilliseconds()).padStart(4, '0')
.substr(0, this.token.length);
}
}
module.exports = Milliseconds;