This package was developed to manipulate dates in the USA and Brazilian format.
First of all, create a package.json:
npm init -y
Install the package:
npm i date_operations_manipulator2
Run the following command:
npm install @types/node --save-dev
NOTE: You can just copy and paste the following codes to see how each one works.
const dateManipulator = require('date_operations_manipulator2');
Note: This package does not use parameters, it contains a property called
"parameters" which is used to pass the values to the class.
usa: boolean //true for USA date format
brazil: boolean //true for Brazilian date format
fullDate: string //It receives a date in a string format
sumYear: number //It receives an integer representing how many years will be added into the date
sumMonth: number //It receives an integer representing how many months will be added into the date
sumDay: number //It receives an integer representing how many days will be added into the date
let usa = new dateManipulator.DateManipulator();usa.parameters.usa = true;
let currentUSAdate = usa.getNewDate();
let br = new dateManipulator.DateManipulator();
br.parameters.brazil = true;
let currentBrDate = br.getNewDate();
usa.parameters.fullDate = currentUSAdate;
usa.parameters.sumYear = 3;
console.log(`3 more years: ${usa.addYearsToDate()}`);
br.parameters.brazil = true;
br.parameters.fullDate = currentBrDate;
br.parameters.sumYear = 1;
console.log(`3 more years: ${br.addYearsToDate()}`);
usa.parameters.usa = true;
usa.parameters.fullDate = currentUSAdate;
usa.parameters.sumDay = 5;
console.log(`5 more days: ${usa.addDaysToDate()}`);
br.parameters.brazil = true;
br.parameters.fullDate = currentBrDate;
br.parameters.sumDay = 5;
console.log(`5 more days: ${br.addDaysToDate()}`);
usa.parameters.usa = true;
usa.parameters.sumMonth = 5;
usa.parameters.fullDate = currentUSAdate;
console.log(`5 more months: ${usa.addMonthsToDate()}`);
br.parameters.brazil = true;
br.parameters.sumMonth = 5;
br.parameters.fullDate = currentBrDate;
console.log(`5 more months: ${br.addMonthsToDate()}`);