1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2024-11-26 18:22:14 +00:00
setup-python/node_modules/prompts/dist/dateparts/meridiem.js

25 lines
421 B
JavaScript
Raw Normal View History

2019-06-27 01:12:00 +00:00
'use strict';
const DatePart = require('./datepart');
class Meridiem extends DatePart {
constructor(opts = {}) {
super(opts);
}
up() {
this.date.setHours((this.date.getHours() + 12) % 24);
}
down() {
this.up();
}
toString() {
let meridiem = this.date.getHours() > 12 ? 'pm' : 'am';
return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
}
}
module.exports = Meridiem;