Download the PHP package gpnalin/module-date-time without Composer
On this page you can find all versions of the php package gpnalin/module-date-time. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package module-date-time
Aligent DateTime API
Overview
The Aligent DateTime API is a Magento 2 module that provides functionality to calculate the difference between two dates. It supports various calculation types and can be accessed via both REST API and GraphQL.
Features
- Calculate the difference between two dates in:
days: Calculate the total number of daysweekdays: Calculate the number of weekdays (Monday to Friday)weeks: Calculate the number of complete weekshours: Calculate the total number of hoursminutes: Calculate the total number of minutesseconds: Calculate the total number of secondsyears: Calculate the number of years
- Support for standard datetime formats with timezone
- REST API endpoint
- GraphQL query
- Unit test and API/GraphQL functional testing
Installation
- If you already have Magento instance setup, skip to #6.
-
Create your project directory then go into it:
-
Download the Docker Compose template:
-
Download the version of Magento you want to use with:
-
Run the setup installer for Magento:
-
Install the module:
-
Enable the module by running:
-
Run the Magento setup upgrade:
-
Compile Dependency Injection:
- Clean the cache:
Usage
REST API
Endpoint
POST /V1/datetime/calculate
Parameters
startDate(string): The start date in ISO 8601 format (e.g., "2023-01-01T00:00:00+00:00")endDate(string): The end date in ISO 8601 format (e.g., "2023-01-10T00:00:00+00:00")calculationType(string): The type of calculation to perform (days, weekdays, weeks, hours, minutes, seconds, years)
Example Request
Example Response
GraphQL
Query
Variables
Example Response
Error Handling
Both the REST API and GraphQL query will return appropriate error messages if the input is invalid or if an unexpected error occurs during calculation.
Notes
- All dates should be provided in standard datetime formats with timezone information.
- If no timezone is specified, UTC is assumed.
- The
endDatemust be greater than or equal to thestartDate.
Test Coverage
-
Unit Test
-
Web API Functional Test
- GraphQL Functional Test