Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-live-clock

Package Overview
Dependencies
Maintainers
2
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-live-clock - npm Package Compare versions

Comparing version 5.4.2 to 5.5.0

3

CHANGELOG.md
# Changelog
## [5.5.0]
Adds suport back for custom Date in the past or future that ticks
## [5.4.2]

@@ -4,0 +7,0 @@ Bump react-router-dom from 5.3.0 to 6.2.1 #141

2

package.json
{
"name": "react-live-clock",
"version": "5.4.2",
"version": "5.5.0",
"description": "React Live Clock",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -21,3 +21,6 @@ import React, {useState, useEffect} from 'react';

} = props;
const [currentTime, setCurrentTime] = useState(Date.now());
const [startTime, setStartTime] = useState(Date.now());
const [currentTime, setCurrentTime] = useState(date ? new Date(date).getTime() : Date.now());
const [formatToUse, setFormatToUse] = useState(format);

@@ -46,4 +49,10 @@ let colonOn = true;

const tick = setInterval(() => {
const now = Date.now();
let now = Date.now();
if (date) {
const difference = Date.now() - startTime;
now = new Date(date).getTime() + difference;
}
if (blinking) {

@@ -83,3 +92,3 @@ if (colonOn) {

className={className}
date={date}
date={ticking ? '' : date}
filter={filter}

@@ -86,0 +95,0 @@ format={formatToUse}

@@ -135,3 +135,3 @@ import React from 'react';

{/* <Panel
<Panel
code={`

@@ -150,5 +150,23 @@ <Clock

timezone={'Australia/Sydney'} />
</Panel> */}
</Panel>
<Panel
code={`
<Clock
date={'2222-12-31T14:15:23+01:00'}
format={'dddd, MMMM Do, YYYY, h:mm:ss A'}
ticking={true}
timezone={'Australia/Sydney'} />
`}
title="Date in the future that ticking">
<Clock
date={'2222-12-31T14:15:23+01:00'}
format={'dddd, MMMM Do, YYYY, h:mm:ss A'}
ticking={true}
timezone={'Australia/Sydney'} />
</Panel>
<Panel
code="<Clock filter={date => date.replace('8', '7a')} format={'HH:mm:ss'} ticking={true} />"

@@ -155,0 +173,0 @@ title="Filter the value before output.">

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc