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

@adactive/arc-clock

Package Overview
Dependencies
Maintainers
5
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adactive/arc-clock - npm Package Compare versions

Comparing version 0.0.1-y.8 to 0.0.1-y.9

src/adsumClock.css

107

index.js

@@ -1,106 +0,3 @@

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import translate from './adsumClock.lang.json';
import AdsumClock from './src/AdsumClock';
require('./clock.less');
class AdsumClock extends Component {
constructor(props) {
super(props);
this.state = {
date: '',
time: ''
};
this.getTime = this.getTime.bind(this);
}
/**
* Clock calls for update every sec
*/
componentDidMount() {
this.timerID = setInterval(
() => this.getTime(),
1000
);
}
/**
* Removing interval
*/
componentWillUnmount() {
clearInterval(this.timerID);
}
getTime() {
const { lang, timeFormat } = this.props;
const time = new Date();
const day = translate[lang].days[time.getDay()];
const date = (time.getDate().toString().length === 1) ? `0${time.getDate()}${translate[lang].date}` : `${time.getDate()}${translate[lang].date}`;
const month = (lang === 'zh') ? `${time.getMonth() + 1}${translate[lang].month}` : translate[lang].month[time.getMonth()];
const year = `${time.getFullYear()}${translate[lang].year}`;
let hours = '';
let minutes = '';
let timeStr = '';
if (timeFormat === '12hrs') {
if (time.getHours() === 12) {
hours = `${time.getHours()}`;
minutes = (time.getMinutes().toString().length === 1) ? `0${time.getMinutes()}` : `${time.getMinutes()}`;
timeStr = `${hours}:${minutes} ${translate[lang].pm}`;
} else if (time.getHours() > 12) {
hours = `${time.getHours() - 12}`;
minutes = (time.getMinutes().toString().length === 1) ? `0${time.getMinutes()}` : `${time.getMinutes()}`;
timeStr = `${hours}:${minutes} ${translate[lang].pm}`;
} else {
hours = `${time.getHours()}`;
minutes = (time.getMinutes().toString().length === 1) ? `0${time.getMinutes()}` : `${time.getMinutes()}`;
timeStr = `${hours}:${minutes} ${translate[lang].am}`;
}
} else {
hours = (time.getHours().toString().length === 1) ? `0${time.getHours()}` : `${time.getHours()}`;
minutes = (time.getMinutes().toString().length === 1) ? `0${time.getMinutes()}` : `${time.getMinutes()}`;
timeStr = `${hours}:${minutes}`;
}
if (lang === 'zh') {
this.setState({
date: `${day}, ${year} ${month} ${date}`,
time: timeStr
});
} else {
this.setState({
date: `${day}, ${date} ${month} ${year}`,
time: timeStr
});
}
}
render() {
return (
<div role="presentation" className="adsum-clock-wrapper" style={this.props.style ? this.props.style : null}>
<div className="adsum-clock">
<div className="day-date">{this.state.date}</div>
<div className="time">{this.state.time}</div>
</div>
</div>
);
}
}
AdsumClock.propTypes = {
lang: PropTypes.string.isRequired,
timeFormat: PropTypes.string.isRequired,
style: PropTypes.objectOf(PropTypes.string)
};
AdsumClock.defaultProps = {
lang: 'en',
timeFormat: '24hrs',
style: null
};
export default AdsumClock;
export { AdsumClock };
{
"name": "@adactive/arc-clock",
"version": "0.0.1-y.8",
"version": "0.0.1-y.9",
"description": "Adsum Clock Component",

@@ -21,24 +21,4 @@ "main": "index.js",

"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "~6.3",
"babel-core": "^6.7.7",
"babel-env": "^2.4.1",
"babel-eslint": "~6.0",
"babel-loader": "^7.1.4",
"babel-minify-webpack-plugin": "^0.3.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.3.13",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-duplicate-keys": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-plugin-transform-proto-to-assign": "^6.9.0",
"babel-plugin-transform-runtime": "~6.9",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-minify": "^0.2.0",
"babel-preset-react": "^6.3.13",
"prop-types": "^15.6.1",
"react": "^16.3.1"
"react": "^16.3.2"
},

@@ -49,3 +29,9 @@ "keywords": [

"redux"
],
"files": [
"index.js",
"src",
"CHANGELOG.md",
"README.md"
]
}
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