astro-ghostcms/.pnpm-store/v3/files/74/3cbb46e786e505898f4cb11e503...

29 lines
588 B
Plaintext
Raw Normal View History

2024-02-14 14:10:47 +00:00
'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;