2.3.0 • Published 7 months ago

@hig/timestamp v2.3.0

Weekly downloads
16
License
Apache-2.0
Repository
github
Last release
7 months ago

Timestamp

The timestamp component presents a date in the past with humanized phrasing in English: "10 minutes/hours/days/months ago".

Getting started

yarn add @hig/timestamp @hig/theme-context @hig/theme-data

Import the component

import Timestamp from '@hig/timestamp';

Basic usage

<Timestamp timestamp="2018-05-05T12:00:00.000Z" />

Styling

Use the className prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component.

Timestamp also has a stylesheet prop that accepts a function wherein you can modify its styles. For instance

import Timestamp from '@hig/timestamp';

function YourComponent() {
  // ...
  const customStylesheet = (styles, props, themeData) => ({
    ...styles,
    timestamp: {
      ...styles.timestamp,
      color: themeData["colorScheme.errorColor"]
    }
  });

  return (
    <Timestamp stylesheet={customStylesheet} timestamp="2018-05-05T12:00:00.000Z" />
  );
}
2.3.0

7 months ago

2.2.0

2 years ago

2.0.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

2.1.0

2 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago