Coder Social home page Coder Social logo

react-pure-time's Introduction

react-pure-time npm package Build Status Dependency Status

React component which convert js date object, milliseconds to human readable format

Features

  • very small
  • UTC support
  • no external dependencies

Usage

import Time from 'react-pure-time';
<Time value="1990-06-16 13:22:17" format="d.m.Y H:i:s" />

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.