Skip to content

adamfrancis-stfc/DBUnit-Date-Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBUnit Hardcoded date converter

This is a small tool that converts hardcoded dates written in DBUnit XML files, to relative dates using the [now+ny+nM+nd] syntax.

Supported date formats

The tool scans for dates in the following formats:

  • "YYYY-MM-DD"
  • "YYYY-MM-DD HH:MM:SS"
  • "YYYY-MM-DD HH:MM:SS.F"

Setup

Clone the repo and navigate to the directory in the terminal. To execute the script run the command below:

python main.py \path\to\test\resources\directory\or\file.xml

Below are the additional optional arguments for the command:

Option Default Description
-o / --output [OUTPUT] "" This allows for a different output directory to be specified for the converted files. The original files will not be modified.
--dry-run False This flag allows you to check the output of the script without saving the results. The resulting file contents will be output once the script has finished executing.

How it works

The tool separates historic and future dates and finds the closest date in each to the present day. It then sets this to a relative value of + or - 1 year (depending on whether it was a historic or future date). The offset between the original date and the new date is calculated and applied to the rest of the dates in their respective groups.

About

This is a small tool that converts hardcoded dates written in DBUnit XML files, to relative dates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages