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.2-y.44.58 to 0.0.2-y.44.59

42

cli.js
#!/usr/bin/env node
'use strict';

@@ -9,28 +8,25 @@ const chalk = require('chalk');

const commander = require('commander');
let cmdValue = '';
const program = require('commander');
program
.usage('npx @adactive/arc-clock copy')
.option('--no-install', 'npx option')
.option('--less-only', 'just copy the style')
.action(function (cmd) {
cmdValue = cmd;
})
.parse(process.argv);
.usage('npx @adactive/arc-clock copy')
.option('--no-install', 'npx option')
.option('--less-only', 'just copy the style')
.action((cmd) => {
cmdValue = cmd;
})
.parse(process.argv);
if(cmdValue === "copy") {
if(program.lessOnly) {
fs.copy(`${__dirname}/src/adsumClock.less`, path.resolve('src/components/adsum-clock/adsumClock.less'))
.then(() => console.log(chalk.green("Success!")) )
.catch(err => console.error(err))
} else {
fs.copy(`${__dirname}/index.js`, path.resolve('src/components/adsum-clock/index.js'))
.then(() => fs.copy(`${__dirname}/src`, path.resolve('src/components/adsum-clock/src')))
.then(() => console.log(chalk.green("Success!")) )
.catch(err => console.error(err))
}
if (cmdValue === 'copy') {
if (program.lessOnly) {
fs.copy(`${__dirname}/src/adsumClock.less`, path.resolve('src/components/adsum-clock/adsumClock.less'))
.then(() => console.log(chalk.green('Success!')))
.catch(err => console.error(err));
} else {
fs.copy(`${__dirname}/index.js`, path.resolve('src/components/adsum-clock/index.js'))
.then(() => fs.copy(`${__dirname}/src`, path.resolve('src/components/adsum-clock/src')))
.then(() => console.log(chalk.green('Success!')))
.catch(err => console.error(err));
}
}
import AdsumClock from './src/AdsumClock';
export default AdsumClock;
{
"name": "@adactive/arc-clock",
"version": "0.0.2-y.44.58",
"version": "0.0.2-y.44.59",
"description": "Adsum Clock Component",

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

@@ -32,9 +32,4 @@ // @flow

constructor(props: AdsumClockPropsType) {
super(props);
timerID: IntervalId = null;
this.getTime = this.getTime.bind(this);
}
timerID: IntervalId;
state = {

@@ -47,3 +42,3 @@ year: '',

dateStr: '',
timeStr: ''
timeStr: '',
};

@@ -57,3 +52,3 @@

(): void => this.getTime(),
1000
1000,
);

@@ -69,8 +64,10 @@ }

getTime() {
getTime = () => {
const { timeFormat } = this.props;
let { lang } = this.props;
if (Object.keys(translate).indexOf(lang) === -1) {
if (Object.keys(translate)
.indexOf(lang) === -1) {
console.warn(`AdsumClock does not support language: ${lang}, goes to default ${AdsumClock.defaultProps.lang}`);
// eslint-disable-next-line prefer-destructuring
lang = AdsumClock.defaultProps.lang;

@@ -82,3 +79,4 @@ }

const dateStr = (time.getDate().toString().length === 1) ? `0${time.getDate()}${translate[lang].date}` : `${time.getDate()}${translate[lang].date}`;
const dateStr = (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()];

@@ -94,16 +92,21 @@ const year = `${time.getFullYear()}${translate[lang].year}`;

hours = `${time.getHours()}`;
minutes = (time.getMinutes().toString().length === 1) ? `0${time.getMinutes()}` : `${time.getMinutes()}`;
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()}`;
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()}`;
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()}`;
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}`;

@@ -118,3 +121,3 @@ }

minutes,
timeStr
timeStr,
};

@@ -129,3 +132,3 @@

this.setState(newState);
}
};

@@ -132,0 +135,0 @@ render(): T {

Sorry, the diff of this file is not supported yet

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