diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-09-27 09:47:26 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-09-27 09:47:26 +0200 |
| commit | 58edcf619ee9d589dd7b54b8a9cbd4271740c13b (patch) | |
| tree | fccd23132f96eb3f5da3b530b78ad826f534687f /src/administration_writer.cpp | |
| parent | bd3f2b84742067d0b9049b9f42f2266f94dbb0f9 (diff) | |
fix shipping info r/w issue. fix date r/w timezone issue.
Diffstat (limited to 'src/administration_writer.cpp')
| -rw-r--r-- | src/administration_writer.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp index c27b3e3..b08723b 100644 --- a/src/administration_writer.cpp +++ b/src/administration_writer.cpp @@ -522,11 +522,22 @@ bool administration_writer_save_project_blocking(project project) int buf_length = 0; char* file_content = administration_writer_copy_template(project_save_template, &buf_length); + struct tm *tm_info = 0; + char date_buffer[11]; // "YYYY-MM-DD" + null terminator + + + strops_replace(file_content, buf_length, "{{PROJECT_ID}}", project.id); strops_replace(file_content, buf_length, "{{PROJECT_DESCRIPTION}}", project.description); strops_replace_int32(file_content, buf_length, "{{PROJECT_STATE}}", project.state); - strops_replace_int64(file_content, buf_length, "{{PROJECT_STARTDATE}}", (long long)project.start_date); - strops_replace_int64(file_content, buf_length, "{{PROJECT_ENDDATE}}", (long long)project.end_date); + + tm_info = gmtime(&project.start_date); + strftime(date_buffer, sizeof(date_buffer), "%Y-%m-%d", tm_info); + strops_replace(file_content, buf_length, "{{PROJECT_STARTDATE}}", date_buffer); + + tm_info = gmtime(&project.end_date); + strftime(date_buffer, sizeof(date_buffer), "%Y-%m-%d", tm_info); + strops_replace(file_content, buf_length, "{{PROJECT_ENDDATE}}", date_buffer); //// Write to Disk. char final_path[50]; |
