Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memcrab/react-pure-time
React component which convert js date object, milliseconds to human readable format
https://github.com/memcrab/react-pure-time
format-converter react time
Last synced: about 1 month ago
JSON representation
React component which convert js date object, milliseconds to human readable format
- Host: GitHub
- URL: https://github.com/memcrab/react-pure-time
- Owner: Memcrab
- Created: 2016-05-07T11:29:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T09:11:33.000Z (over 1 year ago)
- Last Synced: 2024-08-10T10:26:24.324Z (5 months ago)
- Topics: format-converter, react, time
- Language: TypeScript
- Size: 1.84 MB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-pure-time [![npm package](https://img.shields.io/npm/v/react-pure-time.svg?style=flat-square)](https://www.npmjs.org/package/react-pure-time) [![Build Status](https://travis-ci.org/memCrab/react-pure-time.svg?branch=master)](https://travis-ci.org/memCrab/react-pure-time) [![Dependency Status](https://david-dm.org/memCrab/react-pure-time.svg)](https://david-dm.org/memCrab/react-pure-time)
React component which convert js date object, milliseconds to human readable format## Features
- very small
- UTC support
- no external dependencies## Usage
```javascript
import Time from 'react-pure-time';
```## Options
#### value: [string, number, instanceOf(Date)]
Date object, milliseconds or string#### format: string
`Default: 'd.m.Y H:i'`php standart time/date formatting. [PHP date format manual](http://php.net/manual/en/function.date.php)
#### utc: bool
`Default: false`Show in UTC timezone
#### placeholder: string
`Default: —`Shows when date is incorrect or empty
#### className: string
Just a wrapper class## Can be used with values
| Value | Format | Time component | with `utc` flag |
| --- | --- | --- | --- |
| Empty value | — | — | — |
| Empty value with placeholder | — | no time defined | no time defined |
| 1261322332312 | H:i:s | 17:18:52 | 15:18:52 |
| new Date(1261322332312) | d.m.Y H:i:s | 20.12.2009 17:18:52 | 20.12.2009 15:18:52 |
| new Date() | d.m.Y H:i:s | 08.05.2016 16:22:23 | 08.05.2016 13:22:23 |
| 1990-06-16 13:22:17 | d.m.Y H:i:s | 16.06.1990 13:22:17 | 16.06.1990 10:22:17 |
| September 2, 2003, 2:26 am | d.m.Y H:i:s | 02.09.2003 02:26:00 | 01.09.2003 23:26:00 |
| 2003 36 2003 | d.m.Y H:i:s | — | — |