npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cadulis-ion-datetime-picker

v0.6.0-ionic3

Published

Date and/or time picker for awesome ionic framework

Downloads

12

Readme

ion-datetime-picker

npm version Ionic version License

Date and/or time picker for awesome Ionic framework v3

Introduction

I made this component because of poor implementation of native datetime picker in Android webview. How funny it was when I discovered that I can only pick a time between 0:00 and 11:59 on my 24-hour clock phone :)

Looking for a picker that works with Ionic framework v1?

Features

The ion-datetime-picker component has these features:

  • Make Date picker, Time picker, Datetime picker
  • Choose Sunday or Monday as the first day of the week
  • Use 12-hour or 24-hour clock
  • Pick time with or without seconds
  • Configure popup title and button labels
  • Configure i18n to get weekdays and months in your language

Installation

  1. Use npm to install the new module:

    npm install ion-datetime-picker@ionic3 --save
  2. Import the DatetimePickerModule into your project:

    import { DatetimePickerModule } from 'ion-datetime-picker';
    
    @NgModule({
      ...
      imports: [
        DatetimePickerModule,
        ...
      ],
      ...
    })
    export class AppModule {}
       

Usage

Add picker attribute to your ion-datetime elements:

<ion-list>
  <ion-item>
    <ion-label>{{datetimeValue | date: "yyyy-MM-dd H:mm:ss"}}</ion-label>
    <ion-datetime picker [(ngModel)]="datetimeValue"></ion-datetime>
  </ion-item>
</ion-list>

Configuration attributes

date and time attributes

Choose which picker type is used. When neither is set, I assume both and use the datetime picker.

@TODO Use pickerFormat instead.

mondayFirst attribute

Set this if you want to have Monday as the first day of a week.

seconds attribute

By default, in the time picker, I allow to change only hours and minutes. Set this attribute to use also seconds.

@TODO Use pickerFormat instead.

amPm attribute

By default, in the time picker, I use 24-hour clock. Set this attribute to change it to 12-hour clock.

@TODO Use pickerFormat instead.

title and subTitle attributes

Configure the title and sub title of the popup with the picker.

only-valid attribute

Disable/Enable calendar days according to type and date range specified.

only-valid="{'after': '2016-04-09'}"
only-valid="{'after': 'today', 'inclusive': true}"
only-valid="{'outside': {'initial': '2016-04-09', 'final': '2016-06-15'}, 'inclusive': true}"

Types supported: 'after', 'before', 'between' and 'outside'. If you want to include the day specified, set 'inclusive' property to true.

To combine rules, just pass an array and it should do the trick. Rules are complementary (treated with AND, not OR), it means that a date will be available only if it matches all the constraints you pass.

only-valid="[{'after': '2017-01-12'}, {'outside': {'initial': '2017-01-19', 'final': '2017-01-29'}}, {'outside': {'initial': '2017-02-19', 'final': '2017-02-29'}}]"

@TODO Support also min and max attributes.

Other supported attributes inherited from ion-datetime

  • displayFormat and placeholder
  • cancelText and doneText
  • monthNames and dayShortNames

Daylight saving time

The datetime picker is using Date object with your browser's timezone, including any DST. When you change the date, hour, minute, or second, which sets the time to an invalid value because of moving from 2:00 to 3:00 (or similar) at the beginning of DST, the time is automatically adjusted to a valid value. On the other hand, when the DST ends, I do NOT take the inserted hour into consideration, but this may be fixed in the future.