date_operations_manipulator

1.0.11 • Public • Published

This package was developed to manipulate dates in the USA and Brazilian format.

Instructions:

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.

After this, you can import the package into your project

const dateManipulator = require('date_operations_manipulator2');

Now you can use the series of available methods in the package. Available operations:

DateManipulator parameters

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

It creates an object to get the USA date format

let usa = new dateManipulator.DateManipulator();
usa.parameters.usa = true;
let currentUSAdate = usa.getNewDate();

It creates an object to get the Brazilian date format

let br = new dateManipulator.DateManipulator();
br.parameters.brazil = true;
let currentBrDate = br.getNewDate();

It adds three more years in the USA date format

usa.parameters.fullDate = currentUSAdate;
usa.parameters.sumYear = 3;
console.log(`3 more years: ${usa.addYearsToDate()}`);

It adds one more year at Brazilian date format

br.parameters.brazil = true;
br.parameters.fullDate = currentBrDate;
br.parameters.sumYear = 1;
console.log(`3 more years: ${br.addYearsToDate()}`);

It adds 5 days in the USA date format

usa.parameters.usa = true;
usa.parameters.fullDate = currentUSAdate;
usa.parameters.sumDay = 5;
console.log(`5 more days: ${usa.addDaysToDate()}`);

It adds 5 days at Brazilian date format:

br.parameters.brazil = true;
br.parameters.fullDate = currentBrDate;
br.parameters.sumDay = 5;
console.log(`5 more days: ${br.addDaysToDate()}`);

It adds 5 months in the USA date format

usa.parameters.usa = true;
usa.parameters.sumMonth = 5;
usa.parameters.fullDate = currentUSAdate;
console.log(`5 more months: ${usa.addMonthsToDate()}`);

It adds 5 months when at Brazilian date format

br.parameters.brazil = true;
br.parameters.sumMonth = 5;
br.parameters.fullDate = currentBrDate;
console.log(`5 more months: ${br.addMonthsToDate()}`);

Readme

Keywords

Package Sidebar

Install

npm i date_operations_manipulator

Weekly Downloads

0

Version

1.0.11

License

ISC

Unpacked Size

25.7 kB

Total Files

6

Last publish

Collaborators

  • roger_aguiar_dev