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

timezone-js-ts

Package Overview
Dependencies
Maintainers
0
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-js-ts - npm Package Compare versions

Comparing version 3.1.6 to 3.2.0

10

dist/index.d.ts
export declare function getDestinationTime(timezone: string, localeIdentifier?: string): string;
export declare function timezoneConverter(IANA_timezone_destination: string, IANA_timezone_source?: string): any;
export declare function timezoneConverter(IANA_timezone_destination: string, IANA_timezone_source?: string): {
id: number;
currentTime_Dest: string;
diff: {
offset_from_utc: any;
iana_timezone_of_source: string;
iana_timezone_of_destination: string;
};
}[];
export declare function allTimezones(): {

@@ -4,0 +12,0 @@ id: number;

39

dist/index.js

@@ -48,3 +48,3 @@ "use strict";

const zoneData = __importStar(require("./countries-with-timezone.json"));
const fs = __importStar(require("fs"));
// import * as fs from 'fs';
// import * as path from 'path';

@@ -162,22 +162,21 @@ // ---------------------------------------------------------

let fileData = [];
// fetch old data if exists
if (fs.existsSync('./timezoneConverterOutputs.json')) {
const content = fs.readFileSync('./timezoneConverterOutputs.json', 'utf8');
fileData = JSON.parse(content)[0].data;
}
// append new data
// // fetch old data if exists
// if(fs.existsSync('./timezoneConverterOutputs.json')) {
// const content = fs.readFileSync('./timezoneConverterOutputs.json', 'utf8');
// fileData = JSON.parse(content)[0].data;
// }
// // append new data
fileData.push({ id: fileData.length + 1, currentTime_Dest, diff });
let obj = [
{
"data": fileData
}
];
// write data into json file
fs.writeFile('./timezoneConverterOutputs.json', JSON.stringify(obj, null, " "), 'utf-8', err => {
if (err)
throw err;
});
// return this json file as a output
return obj[0].data;
// return { currentTime_Dest, diff };
// let obj = [
// {
// "data": fileData
// }
// ]
// // write data into json file
// fs.writeFile('./timezoneConverterOutputs.json', JSON.stringify(obj, null, " "), 'utf-8', err => {
// if (err) throw err;
// });
// // return this json file as a output
// return obj[0].data;
return fileData;
}

@@ -184,0 +183,0 @@ function allTimezones() {

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

export {};
declare const lib: any;
declare const data: any;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("node:fs"));
const data = [
{ id: 1, name: "testing!" }
];
// OP[0].data.push(...data);
// console.log(OP[0].data);
const jsondata = fs.readFileSync('./timezoneConverterOutputs.json', 'utf8');
console.log(jsondata);
const lib = require('../dist/index');
const data = lib.timezoneConverter('America/New_York');
console.log(data);
{
"name": "timezone-js-ts",
"version": "3.1.6",
"version": "3.2.0",
"description": "",

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

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