Summary
This command converts a date or string to a partial date.
Table of Contents
The first parameter is the object to convert to a partial date (either string or date), and the second parameter is the partial date format(optional).
Attributes
- adjust (optional) – provides the ability to force all unknown portions of a Partial Date to the lowest or highest possible values. The default (none) is partially equivalent to the ‘min’ values with the exception that for comparison purposes, unknown portions are considered to be equivalent to some of the known portions of the date they are being compared against.
Examples with the adjustment as ‘none’
Unknown Date | Comparing Against | Unknown Calculated As |
---|---|---|
UNK/Feb/2016 | 16/Feb/2016 | 01/Feb/2016 |
UNK/UNK/2016 | 16/Feb/2016 | 01/Jan/2016 |
UNK/UNK/UNK | 16/Feb/2016 | 01/Jan/2016 |
Examples with the adjustment as ‘min’
Unknown Date | Comparing Against | Unknown Calculated As |
---|---|---|
UNK/Feb/2016 | 16/Feb/2016 | 01/Feb/2016 |
UNK/UNK/2016 | 16/Feb/2016 | 01/Jan/2016 |
UNK/UNK/UNK | 16/Feb/2016 | 01/Jan/2016 * |
* – The year is equivalent to the comparison date’s year, but set to 1900 if not used in comparison.
Examples with the adjustment as ‘max’
Unknown Date | Comparing Against | Unknown Calculated As |
---|---|---|
UNK/Jul/2016 | 16/Feb/2016 | 31/Jul/2016 * |
UNK/UNK/2016 | 16/Feb/2016 | 30/Dec/2016 ** |
UNK/UNK/UNK | 16/Feb/2016 | 30/Dec/2016 *** |
* – Day is the maximum day of the month if the month is set, otherwise defined as 30 if the month is unset.
** – Month is December, max day is always defined as 30 if the month is unset.
*** – The year is equivalent to the comparison date’s year, but set to 2200 if not used in comparison.
The following tables provides the min and max values:
- none – this is the default value and it does not apply any adjustments to the provided date
- min – forces the date provided to the minimum values for all portions of the date:
Year | 1900 |
Month | 1 |
Day of Month | 1 |
Hour | 0 |
Minute | 0 |
Second | 0 |
Millisecond | 0 |
- max – forces the date provided to the maximum values for all portions of the date:
Year | 2200 |
Month | 12 |
Day of Month | Last Day of the Month |
Hour | 23 |
Minute | 59 |
Second | 59 |
Millisecond | 999 |
Parameters
- one string or date command
- one string command
Example
<script scriptId="prior_dobCk"> <body> <s:alert> <s:expression> <s:or> <s:not> <s:isSet/> </s:not> <s:not> <s:isSet> <s:question> <s:question path="/screening/dm.dob_"/> </s:question> </s:isSet> </s:not> <s:gte> <s:partialDatePath path=":value"/> <s:toPartialDate> <s:datePath path="/screening/dm.dob_:value"/> <s:string value="dd[]/MMM[]/yyyy[]"/> </s:toPartialDate> </s:gte> </s:or> </s:expression> <s:correction> <s:string value="optional"/> </s:correction> <s:text> <s:string value="This date is before the date of birth. Please clarify."/> </s:text> </s:alert> </body> <target typeId="strtdt2_" when='preprocess' shouldReconcile='true'/> <target typeId="enddt_" when='preprocess' shouldReconcile='true'/> <target typeId="strtdtcm" when='preprocess' shouldReconcile='true'/> <target typeId="strtdtcm2" when='preprocess' shouldReconcile='true'/> <dependent path="/screening/dm.dob_"/> </script>
Example With Adjustment Attribute
<script scriptId="prior_dobCk"> <body> <s:alert> <s:expression> <s:or> <s:not> <s:isSet/> </s:not> <s:not> <s:isSet> <s:question> <s:question path="/screening/dm.dob_"/> </s:question> </s:isSet> </s:not> <s:gte> <s:partialDatePath path=":value"/> <s:toPartialDate adjust="min" > <s:datePath path="/screening/dm.dob_:value"/> <s:string value="dd[]/MMM[]/yyyy[]"/> </s:toPartialDate> </s:gte> </s:or> </s:expression> <s:correction> <s:string value="optional"/> </s:correction> <s:text> <s:string value="This date is before the date of birth. Please clarify."/> </s:text> </s:alert> </body> <target typeId="strtdt2_" when='preprocess' shouldReconcile='true'/> <target typeId="enddt_" when='preprocess' shouldReconcile='true'/> <target typeId="strtdtcm" when='preprocess' shouldReconcile='true'/> <target typeId="strtdtcm2" when='preprocess' shouldReconcile='true'/> <dependent path="/screening/dm.dob_"/> </script>
Need more help?
Please visit the Fountayn Contact Information page.