@@ -111,9 +111,27 @@ interface DateValue {
111111type DateFilter = DateValue ;
112112
113113/**
114- * Resolves date keyword with optional delta (e.g., "TODAY-1") to date
115- * @param dateStr date keyword (TODAY, MONTH, YEAR) or date in format YYYY-MM-DD (or beggining)
116- * @returns
114+ * Resolves a date string into a concrete date representation.
115+ * The date string can be a keyword with an optional delta, or a standard date format.
116+ *
117+ * Supported keywords are:
118+ * - `today`: Resolves to the current date in `YYYY-MM-DD` format.
119+ * - `month`: Resolves to the current month in `YYYY-MM` format.
120+ * - `year`: Resolves to the current year in `YYYY` format.
121+ *
122+ * An optional delta can be appended to the keyword to specify an offset.
123+ * For example:
124+ * - `today-1` resolves to yesterday.
125+ * - `month+2` resolves to the month after next.
126+ * - `year-10` resolves to 10 years ago.
127+ *
128+ * If the `dateStr` does not match a keyword pattern, it is returned as is.
129+ * This is to support standard date formats like `YYYY-MM-DD`, `YYYY-MM`, or `YYYY`.
130+ *
131+ * @param dateStr A string representing the date. This can be a keyword
132+ * (e.g., "today", "month-1", "year+5") or a date string
133+ * (e.g., "2023-10-27", "2023-10", "2023").
134+ * @returns A `DateFilter` object containing the resolved date string.
117135 */
118136export function resolveDateParams ( dateStr : string ) : DateFilter {
119137 const match = dateStr . match ( / ^ ( t o d a y | m o n t h | y e a r ) ( [ + - ] \d + ) ? $ / i) ;
0 commit comments