New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

timezone-compare

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-compare - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

.travis.yml

3

dist/index.js

@@ -1,2 +0,1 @@

#!/usr/bin/env node
'use strict';var _inquirer=require('inquirer'),_inquirer2=_interopRequireDefault(_inquirer),_momentTimezone=require('moment-timezone'),_momentTimezone2=_interopRequireDefault(_momentTimezone),_table=require('table'),_informalTimezones=require('./informalTimezones'),_informalTimezones2=_interopRequireDefault(_informalTimezones);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var timezones=_momentTimezone2.default.tz.names();function trim(a){return(a||'').replace(/\s+/g,'')}var FORMAT='MM/DD/YY hh:mm a',tableConfig={columns:{0:{alignment:'center'},1:{alignment:'center'}}},questions=[{type:'input',name:'from_timezone',message:'Enter FROM timezone',default:function _default(){return'America/New_York'}},{type:'input',name:'to_timezone',message:'Enter TO timezone',default:function _default(){return'Europe/London'}}];function findTimezone(a){return timezones.find(function(b){return b.includes(a)})||_informalTimezones2.default[a]}_inquirer2.default.prompt(questions).then(function(a){var b=a.from_timezone,c=a.to_timezone;if(b=trim(b),c=trim(c),!_momentTimezone2.default.tz.zone(b)&&(b=findTimezone(b),!b))throw new Error('from_timezone is not valid');if(!_momentTimezone2.default.tz.zone(c)&&(c=findTimezone(c),!c))throw new Error('to_timezone is not valid');var d=[],e=_momentTimezone2.default.tz(b).startOf('day'),f=e.clone().add(30,'hours');for(e.add(-30,'minutes'),d.push([b,c]);e.isBefore(f);){var h=e.add(30,'minutes').clone(),i=h.clone().tz(c);d.push([h.format(FORMAT)+' '+b,i.format(FORMAT)+' '+c])}var g=(0,_table.table)(d,tableConfig);console.log(g)});
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});exports.getTimesAsStrings=getTimesAsStrings;exports.getTimesAsMoments=getTimesAsMoments;var _TimezoneCompare=require('./TimezoneCompare'),_TimezoneCompare2=_interopRequireDefault(_TimezoneCompare);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default=_TimezoneCompare2.default;function getTimesAsStrings(a,b){return new _TimezoneCompare2.default(a,b).getTimesAsStrings()}function getTimesAsMoments(a,b){return new _TimezoneCompare2.default(a,b).getTimesAsMoments()}

@@ -1,1 +0,1 @@

'use strict';Object.defineProperty(exports,'__esModule',{value:!0});exports.default={IST:'Asia/Kolkata'};
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});exports.default={IST:'Asia/Kolkata'};module.exports=exports['default'];
{
"name": "timezone-compare",
"version": "1.0.8",
"version": "1.0.9",
"bin": {
"timezone-compare": "./dist/index.js"
"timezone-compare": "./dist/cli.js"
},

@@ -28,3 +28,4 @@ "keywords": [

"start": "NODE_ENV=development nodemon --exec babel-node src/index.js",
"build": "npm run clean && BABEL_ENV=production NODE_ENV=production babel src --out-dir dist"
"build": "npm run clean && BABEL_ENV=production NODE_ENV=production babel src --out-dir dist",
"test": "ava"
},

@@ -35,5 +36,7 @@ "repository": "bhargav175/timezone-compare",

"devDependencies": {
"ava": "^0.17.0",
"babel-cli": "^6.18.0",
"babel-eslint": "^7.1.0",
"babel-loader": "^6.2.7",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-polyfill": "^6.16.0",

@@ -56,3 +59,17 @@ "babel-preset-es2015": "^6.18.0",

"table": "^4.0.1"
},
"ava": {
"source": [
"/src/**/*.{js,jsx}",
"!dist/**/*"
],
"concurrency": 5,
"failFast": true,
"tap": true,
"powerAssert": false,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

@@ -1,80 +0,11 @@

#!/usr/bin/env node
import TimezoneCompare from './TimezoneCompare';
import inquirer from 'inquirer';
import momentTimezone from 'moment-timezone';
const timezones = momentTimezone.tz.names();
import {table} from 'table';
import informalTimezones from './informalTimezones';
export default TimezoneCompare;
function trim(s){
return ( s || '' ).replace( /\s+/g, '' );
}
const FORMAT = 'MM/DD/YY hh:mm a';
const tableConfig = {
columns: {
0: {
alignment: 'center',
},
1: {
alignment: 'center',
}
}
export function getTimesAsStrings(from_timezone, to_timezone){
return new TimezoneCompare(from_timezone,to_timezone).getTimesAsStrings();
};
const questions = [
{
type: 'input',
name: 'from_timezone',
message: 'Enter FROM timezone',
default : function(){
return `America/New_York`;
}
},
{
type: 'input',
name: 'to_timezone',
message: 'Enter TO timezone',
default: function () {
return 'Europe/London';
}
},
];
function findTimezone(timezone){
return timezones.find(t=>t.includes(timezone)) || informalTimezones[timezone];
export function getTimesAsMoments(from_timezone,to_timezone){
return new TimezoneCompare(from_timezone,to_timezone).getTimesAsMoments();
}
inquirer.prompt(questions).then(function (answers) {
let {from_timezone, to_timezone} = answers;
from_timezone = trim(from_timezone);
to_timezone = trim(to_timezone);
if(!momentTimezone.tz.zone(from_timezone)){
from_timezone = findTimezone(from_timezone);
if(!from_timezone){
throw new Error('from_timezone is not valid');
}
}
if(!momentTimezone.tz.zone(to_timezone)){
to_timezone = findTimezone(to_timezone);
if(!to_timezone){
throw new Error('to_timezone is not valid');
}
}
const data = [];
const start = momentTimezone.tz(from_timezone).startOf('day');
const end = start.clone().add(30,'hours');
start.add(-30,'minutes');
data.push([from_timezone, to_timezone]);
while(start.isBefore(end)){
const left = start.add(30,'minutes').clone();
const right = left.clone().tz(to_timezone);
data.push([`${left.format(FORMAT)} ${from_timezone}`,`${right.format(FORMAT)} ${to_timezone}`]);
}
const output = table(data, tableConfig);
console.log(output);
});

Sorry, the diff of this file is not supported yet

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