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

@synerise/ds-date-range-picker

v0.31.9

Published

Date-Range-Picker UI Component for the Synerise Design System

Downloads

1,109

Readme


id: date-range-picker title: DateRangePicker

DateRangePicker UI Component

Installation

npm i @synerise/ds-date-range-picker
or
yarn add @synerise/ds-date-range-picker

Usage

import DateRangePicker from '@synerise/ds-date-range-picker'

const value = {
  type: 'ABSOLUTE',
  from: '2018-10-09T00:00:00+02:00',
  to: '2018-12-08T23:59:59+01:00',
};

<DateRangePicker
  showTime
  onApply={console.log}
  showFilter={false}
  showRelativePicker
  value={value}
  forceAbsolute={false}
/>

Demo

API

| Property | Description | Type | Default | | ------------------------- | -------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------- | | disabledDate | Function to specify if particular dates are disabled or not | (date:Date)=>boolean | - | | disabledDefaultTexts | Disables the default texts translations provided by react-intl | boolean | false | | forceAbsolute | Force the outcome to be converted to an absolute date | boolean | false | | format | Format of the value displayed in the footer | string | "MMM D, YYYY" | | onApply | Callback executed after applying changes | (date:Date)=>void | - | | ranges | An array containing custom ranges which may be used as a short-hand | DateRange[] | [] | | popoverProps | Object representing props applied to the Antd Popover component | AntdPopoverProps | {} | | rangeUnits | Units available in relative range picker | RelativeUnits[] | ['SECONDS','MINUTES','HOURS','DAYS','WEEKS','MONTHS','YEARS'] | | readOnly | Makes picker readonly | boolean | false | | disabled | Makes picker disabled | boolean | false | | relativePast | Enable relative filter for past ranges | boolean | false | | relativeFuture | Enable relative filter for future ranges | boolean | false | | showTime | Enable user to choose particular hour | boolean | false | | showNowButton | Include "now" button to select current time (last minue) | boolean | true | | showFilter | Enable range filtering | boolean | false | | showCustomRange | Enable custom range form in relative range picker | boolean | true | | validate | Function to specify if particular date ranges are correct | (date:Date)=>boolean | - | | value | Value of the picker | DateRange | | | defaultValue | Default value of the picker (when value is undefined and when user clears input) | DateRange | | | startAlwaysOnTheLeft | Enable not to move month from left side to right side | boolean | false | | onVisibleChange | Callback executed when popover with dateRangePicker changes its visibility | (visible: boolean) => void | - | | filterValueSelectionModes | Allowed modes to display in filter | DateLimitMode[] | ["Range", "Hour"] | | getPopupContainer | Function used to set the container of the date range picker. | Function(triggerNode) | () => document.body | | texts | custom translations | Texts | undefined | | disableDefaultTexts | disable DS translations fallback | boolean | false

DateRange

| Property | Description | Type | Default | | -------- | ---------------------------------------------- | ------------------------------------- | ------- | | from | Start date | Date / string | - | | to | End date | Date / string | - | | type | String key for identifying the range type | 'ABSOLUTE' / 'RELATIVE' / 'SINCE' | - | | duration | Duration of the relative range | {type: RelativeUnit, duration:number} | - | | offset | Offset of the relative range from today's date | {type: RelativeUnit, duration:number} | - |

RelativeUnit = 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS'

Texts

  • texts prop is now optional

  • all keys in texts is now also optional

  • if texts is undefined or if a key in texts is undefined default DS translations will appear in the component

  • disableDefaultTexts disables the above fallback, i.e. if any key is missing in texts then an empty string is used as a translation (this prop is provided for testing custom translation completeness)

| translation key | Type | Default | | ------------------------ | ----------------- | -------- | | endDatePlaceholder | string | -------- | | startDatePlaceholder | string | -------- | | selectDate | string | -------- | | selectTime | string | -------- | | filterName | string | -------- | | custom | ReactNode | -------- | | today | ReactNode | -------- | | yesterday | ReactNode | -------- | | apply | ReactNode | -------- | | clear | ReactNode | -------- | | now | ReactNode | -------- | | emptyDateError | ReactNode | -------- | | last7Days | ReactNode | -------- | | thisWeek | ReactNode | -------- | | lastWeek | ReactNode | -------- | | thisMonth | ReactNode | -------- | | lastMonth | ReactNode | -------- | | last3Months | ReactNode | -------- | | last6Months | ReactNode | -------- | | lastYear | ReactNode | -------- | | allTime | ReactNode | -------- | | tomorrow | ReactNode | -------- | | next7Days | ReactNode | -------- | | nextWeek | ReactNode | -------- | | nextMonth | ReactNode | -------- | | next3Months | ReactNode | -------- | | next6Months | ReactNode | -------- | | nextYear | ReactNode | -------- | | more | ReactNode | -------- | | relativeDateRange | ReactNode | -------- | | last | ReactNode | -------- | | before | ReactNode | -------- | | after | ReactNode | -------- | | since | ReactNode | -------- | | next | ReactNode | -------- | | seconds | ReactNode | -------- | | minutes | ReactNode | -------- | | hours | ReactNode | -------- | | days | ReactNode | -------- | | weeks | ReactNode | -------- | | months | ReactNode | -------- | | years | ReactNode | -------- | | timestampLast | ReactNode | -------- | | timestampNext | ReactNode | -------- | | timestampTill | ReactNode | -------- | | filter | ReactNode | -------- | | startDate | ReactNode | -------- | | endDate | ReactNode | -------- | | remove | ReactNode | -------- | | savedFiltersTrigger | ReactNode | -------- | | clearRange | ReactNode | -------- | | copyRange | ReactNode | -------- | | pasteRange | ReactNode | -------- | | range | ReactNode | -------- | | hour | ReactNode | -------- | | filterEnabled | ReactNode | -------- | | selectDateFilter | ReactNode | -------- | | datesFilter | ReactNode | -------- | | cancel | ReactNode | -------- | | everyDay | ReactNode | -------- | | nthDayOfMonth | ReactNode | -------- | | daysOf | ReactNode | -------- | | countedFrom | ReactNode | -------- | | addRule | ReactNode | -------- | | addTime | ReactNode | -------- | | change | ReactNode | -------- | | weekly | ReactNode | -------- | | monthly | ReactNode | -------- | | daily | ReactNode | -------- | | saveFilter | ReactNode | -------- | | selected | ReactNode | -------- | | selectDaysDescription | ReactNode | -------- | | selectAll | ReactNode | -------- | | unselectAll | ReactNode | -------- | | inverseSelection | ReactNode | -------- | | setTimeFor | ReactNode | -------- | | week | ReactNode | -------- | | month | ReactNode | -------- | | beginning | ReactNode | -------- | | ending | ReactNode | -------- | | maximumRanges | ReactNode | -------- |

Undocumented props

  • min in MonthlyFilter - controls minimal amount of entires in monthly filter, disable with undefined, default is 1