timezone-js-ts
Advanced tools
Comparing version 3.1.6 to 3.2.0
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; |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
11589396
10947