GithubHelp home page GithubHelp logo

jabbers / ionic4-date-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from write2sv/ionic4-date-picker

0.0 0.0 0.0 219 KB

Calendar date picker for Ionic4 apps

License: MIT License

TypeScript 100.00%

ionic4-date-picker's Introduction

Ionic Date Picker Component

This is a date picker component for your Ionic 4 app.

How to use

1) Install using npm

    npm i ionic4-date-picker --save

2) Add it to your ngModule in .module

import { DatePickerModule } from 'ionic4-date-picker';
   
@NgModule({
 ...,
  imports: [
    ....
    DatePickerModule
    ....
  ],
  ....
})

3) Use the directive ionic-calendar-date-picker in your html

    <ionic-calendar-date-picker (onSelect)="dateSelected($event)"></ionic-calendar-date-picker>	

Options

(onSelect) - An event that is created when a date is selected. Outputs Date object.

[date] - A date object that sets the selected date in the calendar. (not required. Default is today)

[fromDate] - A date object that sets the min date in the calendar. (not required)

[toDate] - A date object that sets max date in the calendar. (not required)

[monthLabels] - An array of month label strings. (not required. Default is ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];)

[dayLabels] - An array of day label strings. (not required. Default is ['S', 'M', 'T', 'W', 'T', 'F', 'S'];)

[validDates] - An array of Date objects. When this is provided all the other dates will be disabled. The component still respects start date and end date if provided (not required. Default is [];)

Styling Option by Date

[dateStyles] - An Java dictionary representing style (value) for each date in YYYY-MM-DD (key in ISO). For eg: dateStyles = { '2019-04-10': {'background-color': 'red'}, '2019-04-09': {'background-color': 'green'}, '2019-04-08': {'background-color': 'blue'}, }; Hint: You can use toDate().toISOString().slice(0,10) on your Date object to quickly get the key.

Styling Options

  <ionic-calendar-date-picker [notInCalendarStyle]="{'color': 'red', 'font-weight': 'bold'}"></ionic-calendar-date-picker>

None of these are required options.

[backgroundStyle] - Background color of the component. Default: { 'background-color': '#ffffff' };

[notInCalendarStyle] - When a day is not in the calendar. Default: { 'color': '#8b8b8b' };

[dayLabelsStyle] - Day Label styling (S, M, T, W ... ). Default: { 'font-weight': 500, 'font-size': '14px' };

[monthLabelsStyle] - Month Label Styling (Jan, Feb, Mar ... ). Default: { 'font-size': '15px' };

[yearLabelsStyle] - Year Label Styling (2000, 2001 ...). Default: { 'font-size': '15px' };

[itemSelectedStyle] - Styling on selected Item by the user. Default: { 'background': '#488aff', 'color': '#f4f4f4 !important' };

[todaysItemStyle] - Styling on showing todays Day, Month, Year. Default: { 'color': '#32db64' };

[invalidDateStyle] - Styling on invalid Dates when you provide validDates input. Default: { 'text-decoration': 'line-through', 'color': 'red' };

4) Pictures

Day Selection Year Selection Month Selection Demo

ionic4-date-picker's People

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.