source: frontend/node_modules/prompts/dist/dateparts/month.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 648 bytes
Line 
1'use strict';
2
3const DatePart = require('./datepart');
4
5class Month extends DatePart {
6 constructor(opts = {}) {
7 super(opts);
8 }
9
10 up() {
11 this.date.setMonth(this.date.getMonth() + 1);
12 }
13
14 down() {
15 this.date.setMonth(this.date.getMonth() - 1);
16 }
17
18 setTo(val) {
19 val = parseInt(val.substr(-2)) - 1;
20 this.date.setMonth(val < 0 ? 0 : val);
21 }
22
23 toString() {
24 let month = this.date.getMonth();
25 let tl = this.token.length;
26 return tl === 2 ? String(month + 1).padStart(2, '0') : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
27 }
28
29}
30
31module.exports = Month;
Note: See TracBrowser for help on using the repository browser.