Calc Dates : Calculate diff between dates

CalcDates is a small utility for DO, which makes it easy to calculate the period between two dates, displaying the result in a user-friendly format.

Main features:

  • Easy to use.
  • Compatible with DO 12 and DO 13.
  • Allows to copy the dates used for the calculation and the result in a Tab-separated format.
  • Configurable date display format.
    image

HOW TO INSTALL
Download the file below. Then:
DO 12 : Open Preferences. Then go to Toolbars > Scripts and drag the downloaded file to that window.
DO 13 : Run Prefs SCRIPTINSTALL and select the downloaded file.
:warning: IMPORTANT: Needs at least DO v12.33
CalcDates.js.txt (12.4 KB)

OPTIONS

In the Script Management window, select CalcDates and click in the gear icon.


Screenshot 2024-01-06 223604

  • date_format: Valid DOpus syntax for displaying dates in a specific format. You can visit this section in the manual for more information about it.
  • debug: Useful if you have some problems with results obtained and want to see the command line generated by the script. You can select the log level as OFF, ALL or WARNING.
  • use_today: If true, prefill end date with today's date value.
    It only affects collections and subcollections created by this command.
  • value_sep: Separator to use between the years, months and day calculated.

USAGE
Type > CalcDates in the FAYT bar. Or you can also use it in a button.
Calc Dates.dcf (294 Bytes)

Now simply type the start and end dates you want to use for calculation. Those values first will be checked to see if they are valid dates. An error message will be displayed in case they're not.
You can reuse the same dialog window as many times as you want. Press OK or simply close the window when you are done.
When the start date or end date have edit controls have focus, you can type T to set that field to the current date.
Use Clear Dates button to clear start and end dates.
If Copy to Clipboard button is enabled, you can use it to copy to clipboard the start and end dates, as well as the result, in a Tab-separated format. Then you can copy those values in a Excel spreadsheet or whatever you want.
458

NOTE
Currently, texts in dialog can be displayed in Spanish (when the DO language is set to Spanish - Mexico) or in English for all other languages. For DO 13, certain values are displayed in the language in which DO is currently set.
If you want to translate it to your language, you can send me a DM.

CHANGELOG

v1.0.0 (2024-01-06) : Initial release

8 Likes

Thank you very much @errante for sharing this practical script with everyone. Another great advantage of it is that it performs the age calculation in real time, which allows the calculation of several ages without having to leave the same window. :star_struck: