Use empty end date instead of 0 when editing repetitions
Since commit 987fa9d (Allow to omit end date in repetitions,
2019-06-03), one can provide an empty date instead of using the value 0
to omit the end date of a repetition. Use this as default value when
editing repetitions without an end date.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
24
src/utils.c
24
src/utils.c
@@ -487,22 +487,6 @@ int date_cmp_day(time_t d1, time_t d2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return a string containing the date, given a date in seconds. */
|
||||
char *date_sec2date_str(time_t sec, const char *datefmt)
|
||||
{
|
||||
struct tm lt;
|
||||
char *datestr = (char *)mem_calloc(BUFSIZ, sizeof(char));
|
||||
|
||||
if (sec == 0) {
|
||||
strncpy(datestr, "0", BUFSIZ);
|
||||
} else {
|
||||
localtime_r(&sec, <);
|
||||
strftime(datestr, BUFSIZ, datefmt, <);
|
||||
}
|
||||
|
||||
return datestr;
|
||||
}
|
||||
|
||||
/* Generic function to format date. */
|
||||
void date_sec2date_fmt(time_t sec, const char *fmt, char *datef)
|
||||
{
|
||||
@@ -522,6 +506,14 @@ void date_sec2date_fmt(time_t sec, const char *fmt, char *datef)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return a string containing the date, given a date in seconds. */
|
||||
char *date_sec2date_str(time_t sec, const char *datefmt)
|
||||
{
|
||||
char *datestr = (char *)mem_calloc(BUFSIZ, sizeof(char));
|
||||
date_sec2date_fmt(sec, datefmt, datestr);
|
||||
return datestr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used to change date by adding a certain amount of days or months.
|
||||
* Returns 0 on success, 1 otherwise.
|
||||
|
||||
Reference in New Issue
Block a user