4.0.31 • Published 2 years ago

@bbc/psammead-timestamp v4.0.31

Weekly downloads
1,234
License
Apache-2.0
Repository
github
Last release
2 years ago

psammead-timestamp - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

Displays a timestamp, with suitable semantic markup.

When to use this component

For displaying an isolated timestamp, separate from the other content in an article or cell.

When not to use this component

When a date or time is to be displayed inline inside a paragraph.

Installation

npm install @bbc/psammead-timestamp

Props

ArgumentTypeRequiredDefaultExample
datetimestring (supported formats)YesN/A2006-09-24T05:00-07:00
typographyFuncfunctionNogetBrevierfunction getPica(script){ return 'font-size: 28'; }
paddingbooleanNotruefalse
scriptobjectYesN/A{ canon: { groupA: { fontSize: '28', lineHeight: '32',}, groupB: { fontSize: '32', lineHeight: '36', }, groupD: { fontSize: '44', lineHeight: '48', }, }, trafalgar: { groupA: { fontSize: '20', lineHeight: '24', }, groupB: { fontSize: '24', lineHeight: '28', }, groupD: { fontSize: '32', lineHeight: '36', }, }, }
servicestringYesN/A'news'
darkModeboolnofalsetrue

Usage

import { latin } from '@bbc/gel-foundations/scripts';
import { getPica } from '@bbc/gel-foundations/typography';

const WrappingContainer = () => (
  <Timestamp
    datetime="2019-03-01T14:00+00:00"
    typographyFunc={getPica}
    padding={false}
    script={latin}
    service="news"
  >
    Friday 1 March 2019
  </Timestamp>
);

Accessibility notes

The usage of the semantic time element within this component can result in strange behaviours when using assistive technology such as VoiceOver for iOS. Specifically, it results in a "text splitting" behaviour, where any text in the prefix is read out, but the value inside the semantic time element require an additional swipe before being read out.

However, as we heavily encourage the use of this semantic element, and want to ensure it's usage is in line with the W3C examples, we feel this compromise is necessary.

Contributing

Simorgh is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Simorgh respository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Simorgh is Apache 2.0 licensed.

4.0.30

2 years ago

4.0.31

2 years ago

4.0.29

2 years ago

4.0.28

3 years ago

4.0.27

3 years ago

4.0.26

3 years ago

4.0.25

3 years ago

4.0.24

3 years ago

4.0.23

3 years ago

4.0.22

3 years ago

4.0.21

3 years ago

4.0.20

3 years ago

4.0.19

3 years ago

4.0.18

3 years ago

4.0.17

3 years ago

4.0.16

3 years ago

4.0.15

3 years ago

4.0.14

3 years ago

4.0.13

3 years ago

4.0.12

3 years ago

4.0.11

3 years ago

4.0.10

3 years ago

4.0.9

3 years ago

4.0.8

3 years ago

4.0.7

3 years ago

4.0.6

3 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.3

3 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0-alpha.0

4 years ago

2.2.38

4 years ago

2.2.37

4 years ago

2.2.36

4 years ago

2.2.35

4 years ago

2.2.34

4 years ago

2.2.33

4 years ago

2.2.32

4 years ago

2.2.31

4 years ago

2.2.30

4 years ago

2.2.29

4 years ago

2.2.28

4 years ago

2.2.27

4 years ago

2.2.26

4 years ago

2.2.25

4 years ago

2.2.24

4 years ago

2.2.22

4 years ago

2.2.23

4 years ago

2.2.21

4 years ago

2.2.20

4 years ago

2.2.19

4 years ago

2.2.18

4 years ago

2.2.17

5 years ago

2.2.16

5 years ago

2.2.15

5 years ago

2.2.14

5 years ago

2.2.13

5 years ago

2.2.12

5 years ago

2.2.11

5 years ago

2.2.10

5 years ago

2.2.9

5 years ago

2.2.8

5 years ago

2.2.7

5 years ago

2.2.6

5 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago