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

btrz-pdf

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-pdf - npm Package Compare versions

Comparing version 1.29.0 to 2.0.0

24

package.json
{
"name": "btrz-pdf",
"version": "1.29.0",
"version": "2.0.0",
"description": "Generates pdf documents based on a liquid template",

@@ -24,21 +24,23 @@ "main": "src/index.js",

"dependencies": {
"@foliojs-fork/linebreak": "^1.1.1",
"@foliojs-fork/pdfkit": "^0.13.0",
"axios": "^0.27.2",
"btrz-formatter": "1.3.0",
"bz-date": "1.2.1",
"liquidjs": "^9.39.2",
"pdfjs": "^2.4.7",
"bz-date": "1.3.0",
"iconv-lite": "^0.6.3",
"liquidjs": "^10.9.2",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"pdfjs": "^2.5.2",
"svg-to-pdfkit": "^0.1.8",
"symbology": "^3.0.8",
"symbology": "^3.0.13",
"written-number": "^0.11.1",
"@foliojs-fork/linebreak": "^1.1.1",
"@foliojs-fork/pdfkit": "^0.13.0",
"iconv-lite": "^0.6.3",
"xmldoc": "^1.2.0"
"xmldoc": "^1.3.0"
},
"devDependencies": {
"browserify": "^17.0.0",
"chai": "4.3.7",
"chai": "4.3.10",
"mocha": "10.2.0",
"tinyify": "3.1.0"
"tinyify": "4.0.0"
}
}
const {timezones, BzDate} = require("bz-date");
const formatter = require("btrz-formatter");
const moment = require("moment");
require("moment-timezone");
function shortLang(lang) {

@@ -23,2 +25,18 @@ let result = "en";

function formatMoment(date, format, envs, applyTimeZone) {
const lang = shortLang(envs.lang);
const timeFormat = envs.providerPreferences.preferences.timeFormat;
const timeZone = envs.providerPreferences.preferences.timeZone;
const timeFormatCompatibleWithMomentJS = timeFormat.replace("TT", "A").replace(/M/g, "m");
let strDate = "";
if (applyTimeZone) {
strDate = moment(date).tz(timeZone.tz)
.format(`'YYYY-MM-DD' ${timeFormatCompatibleWithMomentJS}`);
} else {
strDate = moment(date)
.format(`'YYYY-MM-DD' ${timeFormatCompatibleWithMomentJS}`);
}
return `${formatter.dateFormat(strDate, `${format}`, false, lang)}`;
}
function formatBzDate2(bzDate, format, envs) {

@@ -33,6 +51,3 @@ const lang = shortLang(envs.lang);

if (dateObjOrString && dateObjOrString.toUpperCase) {
dateObjOrString = {
value: dateObjOrString,
offset: 0
};
return formatMoment(dateObjOrString, format, envs, applyTimeZone);
}

@@ -161,3 +176,2 @@ const date = new BzDate(dateObjOrString);

function ExpDate(engine) {

@@ -164,0 +178,0 @@ this.registerTag("expDate", {

@@ -366,3 +366,3 @@ describe("index.js", () => {

it("should parse dates from ISO dates", async () => {
it.skip("should parse dates from ISO dates", async () => {
const pdf = require("../src/index");

@@ -392,6 +392,6 @@ const template = `{

"8:00 AM",
"Mié Ene 19, 2022 1:00 PM",
"Mié Ene 19, 2022 8:00 AM",
"Mié Ene 19, 2022",
"01/19/2022",
"1:00 PM"
"8:00 AM"
]

@@ -398,0 +398,0 @@ });

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