Coder Social home page Coder Social logo

kesarion / angular2-air-datepicker Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 10.0 3.28 MB

Angular2 Datepicker | Native implementation of air-datepicker

Home Page: http://t1m0n.name/air-datepicker/docs/

License: MIT License

TypeScript 73.15% CSS 23.28% JavaScript 2.70% HTML 0.88%
air-datepicker angular2-datepicker datepicker timepicker

angular2-air-datepicker's People

Contributors

damianog avatar dependabot[bot] avatar kesarion avatar stakct avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

angular2-air-datepicker's Issues

Add russian language

Hello! Can you add new language (russian). I need to add the follow code to language library:
['ru', new AirLanguage(
['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'],
['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'],
['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь']
)] as [string, AirLanguage],
?

shows wrong date when set from component

@kesarion when date comes from server and it set from component it set day before correct day
template:

   <div class="form-element position-relative">
            <label for="dateOfBirth">Дата рождения</label>
            <input type="text" id="dateOfBirth" class="birthday" name="DateOfBirth" readonly placeholder="ДД.ММ.ГГГГ"
              formControlName="dateOfBirth" (focus)="datePickerIsActive = true" (blur)="datePickerIsActive = false">

            <air-datepicker class="air-datepicker" [airOptions]="datePickerOption" [(airDate)]="datePickerDate"
              (airChange)="dateChanged($event)" [ngClass]="{'air-datepicker-active': datePickerIsActive}" tabindex="100"
              (focus)="datePickerIsActive = true" (blur)="datePickerIsActive = false">
            </air-datepicker>

  </div>

Component:

  datePickerOption: object;
  datePickerDate: Date;

ngOnInit(): void {
    const { day, month, year } = { day: 31, month: 8, year: 2020 };
    this.setOptiontsToDatePicker();
    this.datePickerDate = new Date(year, month - 1, day);
}

 private setOptiontsToDatePicker() {
    const minusFiftyYears = (date: Date): Date => new Date(date.getFullYear() - 50, date.getMonth(), date.getDate());
    const now = new Date(Date.now());
    const fiftyYearsBefore = minusFiftyYears(now);
    const hundredYearsBefore = minusFiftyYears(fiftyYearsBefore);

    this.datePickerOption = {
      language: 'ru',
      enabledDateRanges: [
        { start: fiftyYearsBefore, end: now },
        { start: hundredYearsBefore, end: fiftyYearsBefore }
      ]
    };
  }

Аннотация 2020-08-31 131354

Selected day issue

Hello, @kesarion. I have found an issue in your package. If i select the day of month, for example it will be 31 January, and click the 'next month' button ' it shows me an error: "./AirDatepicker class AirDatepicker - inline template:11:12 caused by: Cannot set property 'selected' of undefined". The reason why this is happening: Your package try to mark 'selected' day which is not exist in the next month. February doesn't contain 31 days. You should fix it by adding a condition.

Last day of enabledDateRanges don't trigger airChange

How to reproduce:

  1. initialize option with following data: this.options = {
    timepicker: false,
    enabledDateRanges: [
    { start: new Date(now - 3 * days), end: new Date(now -2 * days) }
    ]
    };
  2. bind on date changed action
    (airChange)="dateChanged($event)
  3. click on enabled date in calendar
  4. nothing happen, dateChanged is not called

Set minDate maxDate

Hi, I need to set "minDate = new Date()" but, is it implemented? I don't find how to set it.

Date shows incorrect day and calendar

Dates are displaying wrong in the calendar after the recent commits and in the version 1.1.2. And I rolled back to version 1.0.0, now the calendar at least shows correct dates.

image

See below, correct days for Aug month displayed by system calendar.

image

Getting ERROR in AirDatepicker is not an NgModule

      I get the error ERROR in AirDatepicker is not an NgModule when I try to run ng build

     ---These are my package json depencies---
    "dependencies": {
    "@angular/animations": "^4.0.3",
     "@angular/cli": "^1.0.0",
     "@angular/common": "~4.0.0",
    "@angular/compiler": "~4.0.0",
    "@angular/core": "~4.0.0",
    "@angular/forms": "~4.0.0",
    "@angular/http": "~4.0.0",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "~4.0.0",
    "@angular/platform-browser-dynamic": "~4.0.0",
    "@angular/router": "~4.0.0",
    "angular2-air-datepicker": "^0.1.2",
   }

  ---I declared the Module in typings.d.ts---
 declare module 'angular2-air-datepicker';

 --And Loaded it In mY app.module--
 import { AirDatepicker } from 'angular2-air-datepicker';

imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    HttpModule,
    routing,
    AirDatepicker,
 ],

Cannot read property 'daysMin' of undefined

    I get this Error ..
    ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'daysMin' of undefined
   When I try to load my app after i included airdatepicker to my html

   ----HTML---
  <air-datepicker [airOptions]="{ timepicker: true, format12h: true }" [(airDate)]="date" 
  (airChange)="onDateChanged($event)"></air-datepicker>

  ---COMPONENT----
  public date: Date = new Date;
  
  onDateChanged(event:any) {
      console.log(event);
   }

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.