Giter VIP home page Giter VIP logo

inquirer-datepicker-prompt's Introduction

inquirer-datepicker-prompt

Datepicker plugin for Inquirer.js

Datetime prompt

Getting started

install plugin

npm i inquirer-datepicker-prompt

register prompt

inquirer.registerPrompt('datetime', require('inquirer-datepicker-prompt'))

Options

message

Inherited from inquirer, message to be displayed while retrieving response.

format

An array of format specifiers for printing the date to the console. Uses the dateformat mask options. For example:

// 1/1/17 5:00 PM
{
  type: 'datetime',
  name: 'dt',
  message: 'When would you like a table?',
  format: ['m', '/', 'd', '/', 'yy', ' ', 'h', ':', 'MM', ' ', 'TT']
}

// 01/01/2017 05:00 PM
{
  type: 'datetime',
  name: 'dt',
  message: 'When would you like a table?',
  format: ['mm', '/', 'dd', '/', 'yyyy', ' ', 'hh', ':', 'MM', ' ', 'TT']
}

initial

Initial value for datepicker, must be a Date object. If not specified current date and time will be used. Example:

{
  type: 'datetime',
  name: 'dt',
  message: 'When would you like a table?',
  initial: new Date('2017-01-01 12:30'),
}

{date,time}.{min,max}

These specify a range of valid dates/time for entry. Users will be prohibited from entering a value higher.

{
  type: 'datetime',
  name: 'dt',
  message: 'When would you like a table?',

  // Enter only 1/1 to 3/1
  date: {
    min: "1/1/2017",
    max: "3/1/2017"
  },

  // Enter only 9:00AM to 5:00PM
  time: {
    min: "9:00AM",
    max: "5:00PM"
  }
}

time.{seconds, minutes, hours}.interval

These specify the allowed interval (modulo). For instance:

// Minutes can only be entered in intervals of 15 minutes
{
  type: 'datetime',
  name: 'dt',
  message: 'When would you like a table?',
  time: {
    minutes: {
      interval: 15
    }
  }
}

inquirer-datepicker-prompt's People

Contributors

derektbrown avatar lukasz-pluszczewski avatar nuintun avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.