Skip to content
Snippets Groups Projects
Commit fa3d1553 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

New birthdate format: YYYMMDD

Also, fixed get_date(), it returns 0 on success, but the success return logic was inverted:
it only returned 0 if the date was unchanged from the previous value.

Note:
It would be nice if this user editor prompted to save changes if changes have been made a new
user is selected (e.g. with the arrow buttons).
parent 232210b3
Branches
Tags
No related merge requests found
......@@ -2050,7 +2050,7 @@ int get_date(GtkWidget *t, isoDate_t *date)
gtk_calendar_get_date(GTK_CALENDAR(w), &year, &month, &day);
gtk_widget_hide(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(w))));
*date=isoDate_create(year, month+1, day);
return(odate!=*date);
return odate == *date;
}
G_MODULE_EXPORT void get_expiration(GtkWidget *t, gpointer data)
......@@ -2094,18 +2094,19 @@ G_MODULE_EXPORT void get_birthdate(GtkWidget *t, gpointer data)
GtkWidget *w;
int year;
year=atoi(user.birth+6)+1900;
if(year<Y2K_2DIGIT_WINDOW)
year+=100;
if(cfg.sys_misc&SM_EURODATE)
date=isoDate_create(year, atoi(user.birth+3), atoi(user.birth));
else
date=isoDate_create(year, atoi(user.birth), atoi(user.birth+3));
if(!get_date(t, &date)) {
if(user.birth[2] == '/') {
year=atoi(user.birth+6)+1900;
if(year<Y2K_2DIGIT_WINDOW)
year+=100;
if(cfg.sys_misc&SM_EURODATE)
sprintf(user.birth,"%02u/%02u/%02u",isoDate_day(date),isoDate_month(date),isoDate_year(date)%100);
date=isoDate_create(year, atoi(user.birth+3), atoi(user.birth));
else
sprintf(user.birth,"%02u/%02u/%02u",isoDate_month(date),isoDate_day(date),isoDate_year(date)%100);
date=isoDate_create(year, atoi(user.birth), atoi(user.birth+3));
} else
date = atoi(user.birth);
if(!get_date(t, &date)) {
SAFEPRINTF3(user.birth,"%04u%02u%02u",isoDate_year(date),isoDate_month(date),isoDate_day(date));
user_changed(t, data);
w=GTK_WIDGET(gtk_builder_get_object(builder, "eBirthdate"));
if(w==NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment