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

au-date-range-picker

v0.2.0

Published

A date range picker custom fit and styled to the needs of Appuniverse

Downloads

1

Readme

Date Input Picker Ember Addon

This Ember addon serves as a date (range) input picker component, utilizing the Daterangepicker library. It was specifically developed under the commission of the Agency of Home Affairs (ABB) for integration into the BurgernabijeBesluitenDatabank application.

Installation

To install this addon, run the following command in your Ember project:

ember install au-date-range-picker

Usage

To use the date input picker component in your Ember project, simply include it in your template:

<AuDateRangePicker
  @label="Optional label"
  @start="2023-01-01"
  @end="2023-12-31"
  @width="block"
  @cancelAction={{action this.cancelDatePicker}}
  @applyAction={{action this.applyDatePicker}}
  @hideAction={{action this.hideDatePicker}}
/>
@action applyDatePicker(picker, start, end) {
    this.dateRange = start + ' - ' + end;
}

@action hideDatePicker(picker, start, end) {
    return this.start;
}

@action cancel(picker, start, end) {}

You can pass in the following arguments to customize the behavior of the component:

  • start : The initial start date for the date range.
  • end : The initial end date for the date range.
  • actionName : The name of the action to be called when the date range is changed. This action will be called with 3 args: picker, start and end

Configuration

The following options can be passed to <AuDateRangePicker>:

Format

| Name | Default value | Description | | -------- | ------------- | ----------- | | @format | 'D MMM, YYYY' | | | @serverFormat | 'YYYY-MM-DD' | | | @direction | 'ltr' | Locale setting for text direction | | @regional | 'be-nl' | Selected region | | @separator | ' - ' | What character(s) to put between range |

Range

| Name | Default value | Description | | -------- | ------------- | ----------- | | @singleDatePicker | false | Whether to only select a single date (instead of the default two) | | @minDate | undefined | Lowest possible date. If undefined, no limit is set | | @maxDate | undefined | Highest possible date. If undefined, no limit is set | | @datelimit | false | |

Appearance

| Name | Default value | Description | | -------- | ------------- | ----------- | | @firstDay | 0 | What day of the week to start with. 0 = sunday, 1 = monday... | | @placeholder | 'Aangepast bereik' | | | @daysOfWeek | moment.weekdaysMin() | | | @monthNames | moment.monthsShort() | | | @cancelLabel | 'Terug' | Text on the cancel button | | @applyLabel | 'Verder' | Text on the apply button | | @customRangeLabel | 'Aangepast bereik' | | | @showCustomRangeLabel | false | | | @fromLabel | 'Van' | | | @toLabel | 'Tot' | | | @showWeekNumbers | false | | | @showDropdowns | false | |

Classes

| Name | Default value | Description | | -------- | ------------- | ----------- | | @containerClass | 'form-group au-c-content ' | Class for the container | | @inputClass | 'form-control' | Class for the input | | @buttonClasses | ['au-c-button'] | Classes for the buttons | | @applyClass | 'au-c-button--primary' | Class for the apply button | | @cancelClass | 'au-c-button--secondary au-u-margin-right-tiny' | Class for the cancel button | | @labelClass | 'au-u-h5' | Class for all labels/buttons |

TimePicker

| Name | Default value | Description | | -------- | ------------- | ----------- | | @timePicker | false | Whether to enable the timePicker | | @timePicker24Hour | false | | | @timePickerSeconds | false | | | @timePickerIncrement | undefined | |

Dom behaviour

| Name | Default value | Description | | -------- | ------------- | ----------- | | @autoUpdateInput | true | | | @autoApply | false | | | @alwaysShowCalendars | true | | | @context | undefined | | | @removeDropdownOnDestroy | false | | | @parentEl | 'body' | |

Other

| Name | Default value | Description | | -------- | ------------- | ----------- | | @isInvalidDate | noop | | | @isCustomDate | noop | | | @opens | null | | | @drops | null | | | @linkedCalendars | false | |

Ranges

@ranges defines the preset ranges on the left of the date picker. The following format has to be passed:

{
    PRESET-NAME: [STARTDATE, ENDDATE]
}

You can optionally use moment.js for dynamic assignment

{
    Yesterday: [
        moment().subtract(1, 'days').startOf('day'),
        moment().subtract(1, 'days').endOf('day'),
    ],
    'Last week': [moment().subtract(7, 'days'), moment()],
}

Development

To run the tests for this addon, run the following command:

ember test

Contributing

Contributions to this addon are welcome. Please submit a pull request with your changes.

Updating documentation

If you've added or modified any options in date-range-picker.js, you can run npm run docs to automatically update the configuration table. npm run docs is run automatically when using npm run build as well.

License

This addon is licensed under the MIT License. See the LICENSE file for details.