Updated for 5.63.00
The function added a 15th argument to support providing a non-range based date string with an offset from the passed date. This allows it to create things like Saturday, March 5, 2022 when the publication day is Friday, March 4, 2022.
Updated for 5.62.00
The current name of this function is `support_math_dateRangeWithOffset`
What's New?
Client 5.53.19 includes revisions to an internal function that previously only created parts of date ranges to be used as Folio Text Variables in a BLOX Total CMS site. Because of the need to replace the addDateBasedFolioProperties.jsx file for use with Distributed and Automated Production, changes were made to beef up the internal function. Those changes included these new options:
- Producing full folio dates without any range of dates.
- Including the day of the week.
- Using date ranges that work backward.
- Using AP Style shortened months.
- Using Spanish Language dates.
Client 5.60.00-7 made a modification that allows the year to be skipped from numeric options by sending a Y length of 0.
Who is this Intended For?
This document is only useful for the BLOX Total CMS installation team, TownNews' Customer Service departs, and sites with good template masters or information technology teams with experience editing the legacy addDateBasedFolioProperties.jsx files.
Assumptions in this Article
The table of samples below make the following assumptions:
- Today's date is 4 October 2021
- The publication date is 4 March 2022
- Line breaks in the Result or other columns are caused by the display of the table
Samples
Result | Raw Call | Notes | |||
---|---|---|---|---|---|
October 4, 2021 | support_math_dateRangeWithOffset(); | Will use Today's Date regardless of the publication date | |||
Monday, October 4, 2021 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true); | Includes Day of Week | |||
Monday, Oct. 4, 2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, true); | Associated Press (AP) Style Short Months | |||
lunes, 4 octubre 2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, false, true); | Spanish | |||
March 4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D); | Standard use of the Publication Date with the parts coming from the naming convention details | |||
Friday, March 4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true); | Includes Day of Week | |||
Friday, March 4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, true); | Requested AP style abbreviated months, but March isn't abbreviated | |||
viernes, 4 marzo 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, false, true); | As the two above, but in Spanish | |||
4 marzo 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, false, false, true); | As above but drop the day of the week | |||
10.4.2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, undefined, undefined, undefined, undefined, true); | Today's date as numbers | |||
3.4.2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true); | Publication date as numbers | |||
3.4.22 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true, 2); | As above, but year shortened to 2 digits | |||
03.04.2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true, 4, true); | As above, but month and date padded to 2 digits | |||
03.04 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true, 0, true); | As above, but year removed | |||
3,4,2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true, 4, false, ','); | Numbers can have whatever separator you want | |||
Friday, 3|4|2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, true, 4, false, '|', true); | As above, but with pipes and added day of week | |||
October 4-5, 2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, undefined, 1); | Date Range of 1 day forward from Today's date | |||
October 4-5, 2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, '-', 1); | As above, but uses a hyphen instead of an en-dash (hard to see online) | |||
October 4—5, 2021 | support_math_dateRangeWithOffset(undefined, undefined, undefined, '—', 1); | As above, but uses an em-dash | |||
March 4–5, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, 1); | Very standard use of the publication date with a single day range | |||
March 3–4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, -1); | A date range starting with yesterday. This is a new option | |||
Friday–Saturday, March 4–5, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, 1, undefined, undefined, false, 4, false, undefined, true); | Date range with days of the week included | |||
Thursday–Friday, March 3–4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, -1, undefined, undefined, false, 4, false, undefined, true); | As above but starting one day back from the publication day | |||
Friday–Sunday, March 4–April 3, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, -1, 1, undefined, false, 4, false, undefined, true); | The publication date with a full month in the future by using a -1 day offset | |||
Saturday–Friday, February 5–March 4, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, 1, -1, undefined, false, 4, false, undefined, true); | As above, but going backward one month and forward one day | |||
January 1–December 31, 2021 | support_math_dateRangeWithOffset(ncd_o.Y, 1, 1, undefined, -1, 0, 1); | The full year of publication date by hard-coding the month and day and then backing up one day and forward one year | |||
January 1, 2022–December 31, 2023 | support_math_dateRangeWithOffset(ncd_o.Y, 1, 1, undefined, -1, 0, 2); | As above, but two years | |||
sábado–sábado, 1 enero–31 diciembre, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, 1, 1, undefined, -1, 0, 1, false, 4, false, '', true, false, true); | A full year in Spanish and including days of the week | |||
sábado–domingo, 1 enero 2022–31 diciembre 2023 | support_math_dateRangeWithOffset(ncd_o.Y, 1, 1, undefined, -1, 0, 2, false, 4, false, '', true, false, true); | Two years in Spanish | |||
Friday–Thursday, March 4–June 2, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, '–', 90, 0, 0, false, 4, false, undefined, true); | The publication date with a range of 90 days | |||
Friday–Thursday, March 4–10, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, '–', 6, 0, 0, false, 4, false, '', true, true); | One week range (6 days) from the publication date | |||
viernes–jueves, 4–10 marzo 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, '–', 6, 0, 0, false, 4, false, '', true, false, true); | One week range in Spanish | |||
Saturday, March 5, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, true, false, 1); | Tomorrow, but as a single date and not a range. Months use AP abbreviations. But March isn't abbreviated. | sample | ||
Friday, Feb. 18, 2022 | support_math_dateRangeWithOffset(ncd_o.Y, ncd_o.M, ncd_o.D, 0, 0, 0, undefined, undefined, undefined, undefined, undefined, true, true, false, -14); | Two weeks ago as a single date using abbreviated months. | sample |
Putting this to Use
These calls, or variations as needed, are used in a site's addDateBasedFolioProperties.jsx file where the passed argument is the ncd_o value listed above. The results can be assigned to any Text Variable, but only those single letters or single letters followed by single digits will be kept up to date. For example, ncd_o.B, ncd_o.B0, ncd_o.B1, ncd_o.B2 are the publication code, the publication code again, the description and the symbol field as indicated here:

A site's publication codes showing the Code, Description and Symbol columns. The default nature of the BLOX Total CMS client for Adobe InDesign sets ncd_o.B and ncd_o.B0 to the publication code. ncd_o.B1 would be the Description and ncd_o.B2 will hold the Symbol.
Additional Documentation
Check out these links for additional information on Folio Text Variables: https://help.townnews.com/default-folio-text-variables/article_ddb284a0-b102-542f-ab63-14ed7bb6a15b.html