Skip to content

Mortaro/nullstack-date-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nullstack Date Input

Simple input that converts user formatted dates into a date object and the other way around.

Install

npm install --save nullstack-date-input

Usage with one way binding

import Nullstack from 'nullstack';
import DateInput from 'nullstack-date-input';

class Application extends Nullstack {

  deadline = new Date();

  updateDeadline({value}) {
    this.deadline = value;
  }

  render() {
    return (
      <DateInput name="deadline" value={this.deadline} onchange={this.updateDeadline} />
    )
  }

}

export default Application;

Usage with two way binding

import Nullstack from 'nullstack';
import DateInput from 'nullstack-date-input';

class Application extends Nullstack {

  deadline = new Date();

  render() {
    return (
      <DateInput bind={this.deadline} />
    )
  }

}

export default Application;

Setting the hours

The default hour is the start of the day

You can override it by passing true to the endOfDay or beginningOfDay attribute

<DateInput bind={this.startDate} beginningOfDay />
<DateInput bind={this.endDate} endOfDay />

Customization

You can customize the following attributes:

  • id
  • class
  • placeholder
  • disabled
  • data-*

Caveats

Currently this component only works with the DD/MM/YYYY format

License

Nullstack Date Input is released under the MIT License.

About

Date Input for Nullstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published