Git Product home page Git Product logo

enhanced-date-picker's Introduction

EnhancedDatePicker component for Vaadin Flow

This project is fork of DatePicker component for Vaadin Flow. On top of basic functionality of DatePicker, it has ability to format date by pattern. Formatting is done by JavaScript library date-fns v2.0.0-beta.2. More information about supported formatting paterns can be found here: https://date-fns.org/v2.0.0-beta.2/docs/format

Formatting pattern can be set using method setPattern(String formattingPattern). For example:

EnhancedDatePicker datePicker;
datePicker.setPattern("dd-MMM-yyyy");

or by using constructor: new EnhancedDatePicker(LocalDate.now(), "dd-MMM-yyyy");

Patterns used for parsing user's input can be set using method setParsers(String ... parserPatterns). For example:

EnhancedDatePicker datePicker;
datePicker.setParsers("dd-MM-yy", "dd/MM/yy", "dd/MM/yyyy");

or by using constructor: new EnhancedDatePicker(LocalDate.now(), "dd-MMM-yyyy", "dd-MM-yy", "dd/MM/yy", "dd/MM/yyyy");

This component can be used in combination with <vaadin-date-picker>. In HTML/JS template you can add <vaadin-date-picker id="datePickerId"></vaadin-date-picker> and in Java side, you can bind it to EnhancedDatePicker like this:

@Id("datePickerId")
private EnhancedDatePicker datePicker;

NOTE: Localization in this component is also done by DateFns and some locales for some patterns are not stable: for example Russian and French for pattern MMM(it adds '.' in the end of month and then it can not parse it back)

Live Demo โ†—

This component is part of Vaadin Component Factory

Running the component demo

Run from the command line:

  • mvn -pl enhanced-date-picker-demo -Pwar install jetty:run

Then navigate to http://localhost:8080/enhanced-date-picker

Running Integration tests

For running integration tests demos execute one of the following lines depending on the desired mode

  • mvn -pl enhanced-date-picker-integration-tests clean jetty:run
  • mvn -pl enhanced-date-picker-integration-tests clean jetty:run -Dvaadin.bowerMode

Then navigate to http://localhost:9998/ for see integration tests demos.

For running all integration tests execute

  • mvn clean install verify

Installing the component

Run from the command line:

  • mvn clean install -DskipTests

Using the component in a Flow application

To use the component in an application using maven, add the following dependency to your pom.xml:

<dependency>
    <groupId>com.vaadin.componentfactory</groupId>
    <artifactId>enhanced-date-picker</artifactId>
    <version>${component.version}</version>
</dependency>

Flow documentation

Documentation for flow can be found in Flow documentation.

Contributing

License

Apache Licence 2

enhanced-date-picker's People

Contributors

zhesun88 avatar skrikjo avatar tarekoraby avatar caalador avatar tatulund avatar someonetoignore avatar gilberto-torrezan avatar pekam avatar alvarezguille avatar manolo avatar asashour avatar ahie avatar mstahv avatar mehdi-vaadin avatar mikotin avatar vilmosnagy avatar web-padawan avatar tsuoanttila avatar yuriy-fix avatar keya 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.