diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -4359,19 +4359,23 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 4359 | } | 4359 | } |
| 4360 | 4360 | ||
| 4361 | if (xs_is_string(post_date) && *post_date) { | 4361 | if (xs_is_string(post_date) && *post_date) { |
| 4362 | xs *local_pubdate = xs_fmt("%sT%s", post_date, | 4362 | xs *post_pubdate = xs_fmt("%sT%s", post_date, |
| 4363 | xs_is_string(post_time) && *post_time ? post_time : "00:00:00"); | 4363 | xs_is_string(post_time) && *post_time ? post_time : "00:00:00"); |
| 4364 | 4364 | ||
| 4365 | time_t t = xs_parse_iso_date(local_pubdate, 1); | 4365 | time_t t = xs_parse_iso_date(post_pubdate, 0); |
| 4366 | 4366 | ||
| 4367 | if (t != 0) { | 4367 | if (t != 0) { |
| 4368 | const char *tz = xs_dict_get_def(snac.config, "tz", "UTC"); | ||
| 4369 | |||
| 4370 | t -= xs_tz_offset(tz); | ||
| 4371 | |||
| 4368 | xs *iso_date = xs_str_iso_date(t); | 4372 | xs *iso_date = xs_str_iso_date(t); |
| 4369 | msg = xs_dict_set(msg, "published", iso_date); | 4373 | msg = xs_dict_set(msg, "published", iso_date); |
| 4370 | 4374 | ||
| 4371 | snac_debug(&snac, 1, xs_fmt("Published date: [%s]", iso_date)); | 4375 | snac_debug(&snac, 1, xs_fmt("Published date: [%s]", iso_date)); |
| 4372 | } | 4376 | } |
| 4373 | else | 4377 | else |
| 4374 | snac_log(&snac, xs_fmt("Invalid post date: [%s]", local_pubdate)); | 4378 | snac_log(&snac, xs_fmt("Invalid post date: [%s]", post_pubdate)); |
| 4375 | } | 4379 | } |
| 4376 | 4380 | ||
| 4377 | /* is the published date from the future? */ | 4381 | /* is the published date from the future? */ |