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

@eyoelddefare/datetimeplugin

v0.0.5

Published

Angular material datepicker plugin for time picking

Downloads

166

Readme

Datetimeplugin

This is a time plugin for the datepicker material component from angular material. It allows you to integrate a time picker to select date and time values.

Examples

import { DatetimepluginModule, TIME_FORMAT, DATE_FORMAT  } from "@eyoelddefare/datetimeplugin";

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [MatInputModule, MatNativeDateModule, MatDatepickerModule, DatetimepluginComponent],
  providers: [
    //en-150, am-ET, fa, en-US, ko-KR	
    { provide: MAT_DATE_LOCALE, useValue: 'ko-KR' },
    {
      provide: TIME_FORMAT, useValue: {
        hour: '2-digit',
        minute: '2-digit',
      }
    },
    {
      provide: DATE_FORMAT, useValue: {
        year: 'numeric',
        month: 'short',
        day: '2-digit',
      }
    },
  ],
})

export class AppComponent {
  minDAte = new Date(2024, 1, 1, 9, 45)
  maxDAte = new Date(2025, 1, 1, 12, 54)
  startDate = new Date();
  readOnly = false;

  onDateTimePick(date: Date) { 
    console.log(date);
  }
}
    <mat-form-field>
        <mat-label>Choose a date</mat-label>
        <input [min]="minDAte" [max]="maxDAte" matInput [matDatepicker]="picker1">
        <mat-hint>MM/DD/YYYY</mat-hint>
        <mat-datepicker-toggle matIconSuffix [for]="picker1"></mat-datepicker-toggle>
        <mat-datepicker #picker1></mat-datepicker>

        <ngx-datetime-plugin 
          (pickedDate)="onDateTimePick($event)"
          [inputsReadOnly]="readOnly" 
          [minLocalDatetime]="minDAte" 
          [maxLocalDatetime]="maxDAte" 
          [for]="picker1">
        </ngx-datetime-plugin>

    </mat-form-field>

Usage

To use this plugin, simply follow the example above. If you've provided a min, max, and start date for the <ngx-datetime-plugin/> component, you also must give the same values for the <mat-datepicker/> component as well to stay consistent.

You can also change the locale, and the date and time format you want the <ngx-datetime-plugin/> component to display using the TIME_FORMAT, MAT_DATE_LOCALE, DATE_FORMAT tokens as the example above shows.

Note that the "OK" button uses the same theme provided for the <mat-datepicker/> component. Therefore if you want to change the button theme, provide a theme to the <mat-datepicker/> component. For example, <mat-datepicker [color]="'primary'"></mat-datepicker>.

Date Range

Date range is not currently supported. I don't really have any use case for it and if anyone wants to PR or wish to integrate it into their own solution, it should be replicable using this same plugin component/service.

Sample visual examples

Visual examples with different locals