Skip to main content

Month Picker

Provides api for a month picker with simple API.

Day Picker API is similar as for Node.js EventEmitter class, but provides only on, once, emit functions.

import { MonthPicker } from "@tlgr/date-picker";
const dayPicker = new MonthPicker(options);

extends​

constructor(bot, [options])​

added in 1.0.0
  • bot - <Object>. Telegraf instance.
  • options? - <Object>
    • mode - <'edit' | 'new' | undefined>. Reply mode. Default is edit.
    • date - <Date>. Started date. Default is Date.now().
    • showPast - <boolean>. Show past dates. If false - will render dates before Today as buttons with empty string. Default is false
    • locale - <string>. date locale. Default is en-US.
    • chunk - <number | 'seasons'>. Month render() grid size. Default is 3.
    • controls- <Object>. Controls options.
      • prev - <Object>. Previous control options.
        • symbol - <string>. Render symol. Default is ' '.
        • alert - <Object>. Alert options.
          • text - <string>. Alert text. Default is ''.
          • mode - <string>. Alert mode. Possible values: text or modal. Default is text
          • show - <boolean>. Show modal or not. Default is false.
      • next - <Object>. Previous control options.
        • symbol - <string>. Render symol. Default is ' '.
        • alert - <Object>. Alert options.
          • text - <string>. Alert text. Default is ''.
          • mode - <string>. Alert mode. Possible values: text or modal. Default is text
          • show - <boolean>. Show modal or not. Default is false.
      • empty - <Object>. Previous control options.
        • symbol - <string>. Render symol. Default is ' '.
        • alert - <Object>. Alert options.
          • text - <string>. Alert text. Default is ''.
          • mode - <string>. Alert mode. Possible values: text or modal. Default is text
          • show - <boolean>. Show modal or not. Default is false.

methods​

render()​

added in 1.0.0

Returns Day picker grid.

properties​

date​

added in 1.0.0

modifiers​

  • readonly
  • getter

description​

returns current Date instance.

Events​

Events are not exported, but you can subscribe to events by it's name

Click​

added in 1.0.0

name​

click

payload​

Next​

added in 1.0.0

Fires when next month is clicked

name​

next

payload​

Previous​

added in 1.0.0

Fires when previous month is clicked

name​

prev

payload​

Month​

added in 1.0.0

Fires when subscribed on day event.

name​

month

payload​

  • ctx - <Object>. Telegraf update Context.
  • month - <number> - returns month as number. 0 is January.

Year​

added in 1.0.0

name​

year

payload​