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.8.0 to 1.9.0

2

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

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

@@ -24,3 +24,10 @@ const {timezones, BzDate} = require("bz-date");

function getDate(envs, item, propName, format) {
const date = new BzDate(envs[item][propName]);
let dateObjOrString = envs[item][propName];
if (dateObjOrString && dateObjOrString.toUpperCase) {
dateObjOrString = {
value: dateObjOrString,
offset: 0
};
}
const date = new BzDate(dateObjOrString);
return formatBzDate(date, format, envs);

@@ -121,4 +128,3 @@ }

const format = ctx.environments.providerPreferences.preferences.timeFormat;
if (ctx.environments[this.item][this.propName].toUpperCase) {
if (ctx.environments[this.item][this.propName].toUpperCase && ctx.environments[this.item][this.propName].indexOf("T") === -1){
return getTimeFromString(ctx.environments[this.item][this.propName], format);

@@ -125,0 +131,0 @@ }

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

"displayTotalStr3": "289.00",
arrivalTimestamp: "2022-01-19T13:00:00.000Z",
taxes: [],

@@ -279,2 +280,27 @@ ssrs: [

it("should parse dates from ISO dates", async () => {
const pdf = require("../src/index");
const template = `{
"content": [
"{%- humanDateTime ticket arrivalTimestamp %}",
"{%- humanDate ticket arrivalTimestamp %}",
"{%- dateTime ticket arrivalTimestamp %}",
"{%- dateTime ticket arrivalTimestamp mm/dd/yyyy hh:MM:ss %}",
"{%- dateF ticket arrivalTimestamp %}",
"{%- timeF ticket arrivalTimestamp %}"
]
}`;
const documentDefinition = await pdf.toDocumentDefinition(template, data);
expect(documentDefinition).to.be.eql({
"content": [
"Mié Ene 19, 2022 8:00 AM",
"Mié Ene 19, 2022",
"01/19/2022 8:00 AM",
"01/19/2022 08:00:00",
"01/19/2022",
"8:00 AM"
]
});
});
it("should return a parsed liquidTemplate", async () => {

@@ -281,0 +307,0 @@ const pdf = require("../src/index");

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