mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-05-05 07:07:52 +02:00
Implement wkdaynum("dayname")
This commit is contained in:
+11
@@ -775,6 +775,17 @@ static int FYear(func_info *info)
|
||||
static int FWkdaynum(func_info *info)
|
||||
{
|
||||
int v;
|
||||
Token tok;
|
||||
if (ARG(0).type == STR_TYPE) {
|
||||
/* Convert a day name to a day number */
|
||||
FindToken(ARG(0).v.str, &tok);
|
||||
if (tok.type != T_WkDay) {
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = (tok.val + 1) % 7;
|
||||
return OK;
|
||||
}
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user