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

@equinor/fusion-wc-date

v1.1.3

Published

<!--prettier-ignore-start--> ## `fusion-wc-date` [![Published on npm](https://img.shields.io/npm/v/@equinor/fusion-wc-date.svg)](https://www.npmjs.com/package/@equinor/fusion-wc-date)

Downloads

439

Readme

fusion-wc-date Published on npm

Storybook

Installation

npm install @equinor/fusion-wc-date

DateTime <fwc-datetime>

Example Usage

Date

return (
  <fwc-datetime format={DateTimeFormat.date} date='2021-08-09T11:12:49Z' />
);

Date & Time

return (
  <fwc-datetime format={DateTimeFormat.datetime} date='2021-08-09T11:12:49Z' />
);

Time

return (
  <fwc-datetime format={DateTimeFormat.time} date='2021-08-09T11:12:49Z' />
);

Custom

return (
  <fwc-datetime format='yyyy.MM.dd' date='2021-08-09T11:12:49Z' />
);

Alternative format type

The format variable can also be given as a value instead of a typed enum

return (
  <fwc-datetime format='datetime' date='2021-08-09T11:12:49Z' />
);

With custom locale property

return (
  <fwc-datetime format={DateTimeFormat.time} date='2021-08-09T11:12:49Z' locale='nb' />
);

Properties/Attributes

Name | Type | Default | Description --------------------- | -------------- | ----------- | ----------------- date | string | current date | The date to format in ISO format. See 'ISO_8601'. format | DateTimeFormat* or string | datetime | Predefined or custom format to use. Based on Unicode Technical Standard #35. locale | LocaleName** | enGB | Used to override the locale for which the date format is based. See date-fns Locale.

* DateTimeFormat is exported by fwc-date.

enum DateTimeFormat {
  date='dd.MM.yyyy',
  time='HH:mm',
  datetime='HH:mm dd.MM.yyyy',
  time_with_seconds='HH:mm:ss',
  datetime_with_seconds='HH:mm:ss dd.MM.yyyy',
}

** LocaleName is exported by fwc-date. See date-fns Locale for all supported locales.

type LocaleName = 'enGB' | 'enUS' | 'nb' | ...;

Range <fwc-daterange>

Example Usage

Relative

return (
  <fwc-daterange variant='relative' date='2021-08-09T09:12:49Z' baseDate='2021-08-09T11:12:49Z' />
);

Distance

return (
  <fwc-daterange variant='distance' date='2021-08-09T09:12:49Z' baseDate='2021-08-09T11:12:49Z' />
);

Date & Time (From - To)

return (
  <fwc-daterange
    variant='datetime'
    format={DateTimeFormat.datetime}
    date='2021-08-09T09:12:49Z'
    baseDate='2021-08-09T11:12:49Z'
  />
);

Date & Time with custom separator

return (
  <fwc-daterange
    variant='datetime'
    format={DateTimeFormat.datetime}
    date='2021-08-09T09:12:49Z'
    baseDate='2021-08-09T11:12:49Z'
  >
  <span slot='separator'>to</span>
  </fwc-daterange>
);

With custom locale property

return (
  <fwc-daterange
    variant='datetime'
    format={DateTimeFormat.datetime}
    date='2021-08-09T09:12:49Z'
    baseDate='2021-08-09T11:12:49Z'
    locale='nb'
  >
  <span slot='separator'>to</span>
  </fwc-daterange>
);

Slots

| Name | Default | Description | ------------ | ---------------------- | ----------- | separator | <span>-</span> | Separator element to render between from and to dates for variant datetime.

Properties/Attributes

Name | Type | Default | Description --------------------- | -------------- | ----------- | ----------------- from | string | current date | The date to format in ISO format. See 'ISO_8601'. to | string | current date | The date to compare with in ISO format. See 'ISO_8601'. variant | DateRangeVariant* | datetime | Templated variant to use as basis for format calculation, defaults to datetime (HH:mm dd.MM.yyyy - HH:mm dd.MM.yyyy). format | DateTimeFormat** or string | undefined | Predefined or custom format to use. Based on Unicode Technical Standard #35. locale | LocaleName*** | enGB | Used to override the locale for which the date format is based. See date-fns Locale. seconds | boolean | false | Set true to include seconds in the distance variant. weekstart | WeekDay**** | 1 | The index of the first day of the week (0 = Sunday). suffix | boolean | false | Include a suffix to indicate if the date is before or after the baseDate. Only applies to variant distance. capitalize | boolean | false | Set true to capitalize the first character in the formatted text. Applies to distance and relative variants.

* DateRangeVariant is exported by fwc-date.

type DateRangeVariant = 'relative' | 'distance' | 'datetime';

** DateTimeFormat is exported by fwc-date.

enum DateTimeFormat {
  date = 'dd.MM.yyyy',
  time = 'HH:mm',
  datetime = 'HH:mm dd.MM.yyyy',
  time_with_seconds = 'HH:mm:ss',
  datetime_with_seconds = 'HH:mm:ss dd.MM.yyyy',
}

*** LocaleName is exported by fwc-date. See date-fns Locale for all supported locales.

type LocaleName = 'enGB' | 'enUS' | 'nb' | ...;

**** WeekDay is exported by fwc-date.

type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;