Skip to content

VICEMedia/backend-date-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Developer Challenge

Based on Avanti PHP Test

Challenge

Calculate the difference between two given dates (in the format Y-m-d), without using the php standard library, DateTime, or similar code not written by yourself. This includes composer packages implementing date functions.

Implement the interface Vice\Challenge\DifferenceCalculator, which must return an object implementing Vice\Challenge\DateDifference. Dates are provided to DifferenceCalculator in the format Y-m-d, e.g 2016-12-22.

$difference = DifferenceCalculator::diff('2015-12-12', '2016-12-22');

$difference->getDifferenceInYears() // = 1
$difference->getDifferenceInMonths() // = 0
$difference->getDifferenceInDays() // = 10
$difference->getTotalDifferenceInDays() // = 376

You are free to structure the code anyway you see fit. You may find it easiest to fork this repository and continue from the base provided. Your implementation is expected to match php's DateInterval

Unit tests are strongly encouraged.

About

Date calculation challenge for backend developers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages