{"id":2097,"date":"2017-05-13T11:15:46","date_gmt":"2017-05-13T16:15:46","guid":{"rendered":"https:\/\/bitpost.com\/news\/?p=2097"},"modified":"2017-05-13T11:17:53","modified_gmt":"2017-05-13T16:17:53","slug":"datetime-crushed-with-c-boostgregoriandate-and-ptime-and-javascript-moment-and-bootstrap-datepicker","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2017\/datetime-crushed-with-c-boostgregoriandate-and-ptime-and-javascript-moment-and-bootstrap-datepicker\/","title":{"rendered":"Datetime crushed with C++ boost::gregorian::date and ptime and Javascript moment and bootstrap-datepicker"},"content":{"rendered":"<p>These are really good libraries that got my dates and times flowing client-server full circle, with all the UI and math tools I needed.<\/p>\n<p>KISS!<\/p>\n<pre><code>\r\n  \/\/ Date sanitation: limit ancient and future days and ensure start isn't beyond end\r\n  date today = second_clock::local_time().date();\r\n  date s = startdate;\r\n  date e = enddate;\r\n  if (e > today)\r\n    e = today;    \r\n  if (e - s > date_duration(cn_max_days_to_look_back))\r\n    s = e - date_duration(cn_max_days_to_look_back);\r\n  if (s > e)\r\n    s = e;\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>These are really good libraries that got my dates and times flowing client-server full circle, with all the UI and math tools I needed. KISS! \/\/ Date sanitation: limit ancient and future days and ensure start isn&#8217;t beyond end date today = second_clock::local_time().date(); date s = startdate; date e = enddate; if (e > today) [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[22,19,9],"tags":[],"class_list":["post-2097","post","type-post","status-publish","format-standard","hentry","category-cpp","category-opensource","category-websites"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-xP","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=2097"}],"version-history":[{"count":2,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2097\/revisions"}],"predecessor-version":[{"id":2099,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2097\/revisions\/2099"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=2097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=2097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=2097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}