{"id":109855,"date":"2014-02-26T15:07:47","date_gmt":"2014-02-26T23:07:47","guid":{"rendered":"https:\/\/tri.be\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/"},"modified":"2014-03-13T08:23:34","modified_gmt":"2014-03-13T15:23:34","slug":"wrong-12h24h-time-format-detection","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/","title":{"rendered":"Wrong 12h\/24h time format detection"},"content":{"rendered":"<p>Hello.&lt;br\/&gt;&lt;br\/&gt;<\/p>\n<p>It seems TEC and Community Events don&#8217;t handle correctly the 24h time format.<br \/>\nSeen in &lt;b&gt;the-event-calendar\/lib\/tribe-view-helpers.class.php&lt;\/b&gt;, line 441, &lt;b&gt;TribeEventsViewHelpers::hours()&lt;\/b&gt;:<\/p>\n<pre>$rangeMax = ( strstr(get_option('time_format', TribeDateUtils::TIMEFORMAT), 'H') ) ? 23 : 12;<\/pre>\n<p>&lt;br\/&gt;<\/p>\n<p>Also seen in &lt;b&gt;the-events-calendar-community-events\/lib\/tribe-community-events-template-tags.php&lt;\/b&gt;, lines 196 and 223, &lt;b&gt;tribe_community_events_form_start_time_selector()&lt;\/b&gt; and &lt;b&gt;tribe_community_events_form_end_time_selector()&lt;\/b&gt;:<\/p>\n<pre>if ( !strstr( get_option( 'time_format', TribeDateUtils::TIMEFORMAT ), 'H' ) ) {<\/pre>\n<p>&lt;br\/&gt;<\/p>\n<p>The problem is that &lt;b&gt;G&lt;\/b&gt; is also a &#8220;24h format&#8221;, and, no luck, the default format in French is &lt;b&gt;G \\h i \\m\\i\\n&lt;\/b&gt; for example.<br \/>\nMy way (one among many others) to detect 12h\/24h format:<\/p>\n<pre>function is_12hours_format() {\n\tstatic $is = null;\n\tif ( is_null($is) ) {\n\t\t$format = get_option( 'time_format', TribeDateUtils::TIMEFORMAT );\n\t\t$is     = substr_count( $format, 'H' ) == substr_count( $format, '\\H' ) &amp;&amp; substr_count( $format, 'G' ) == substr_count( $format, '\\G' );\n\t}\n\treturn $is;\n}<\/pre>\n<p>&lt;br\/&gt;<\/p>\n<p>This way I check for &lt;b&gt;G&lt;\/b&gt; and &lt;b&gt;H&lt;\/b&gt; and possible escaped characters (same count = they&#8217;re all escaped), and not only the first character of the string.<\/p>\n<p>Cheers \ud83d\ude42<\/p>\n","protected":false},"template":"","class_list":["post-109855","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wrong 12h\/24h time format detection -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wrong 12h\/24h time format detection -\" \/>\n<meta property=\"og:description\" content=\"Hello.&lt;br\/&gt;&lt;br\/&gt; It seems TEC and Community Events don&#8217;t handle correctly the 24h time format. Seen in &lt;b&gt;the-event-calendar\/lib\/tribe-view-helpers.class.php&lt;\/b&gt;, line 441, &lt;b&gt;TribeEventsViewHelpers::hours()&lt;\/b&gt;: $rangeMax = ( strstr(get_option(&#039;time_format&#039;, TribeDateUtils::TIMEFORMAT), &#039;H&#039;) ) ? 23 : 12; &lt;br\/&gt; Also seen in &lt;b&gt;the-events-calendar-community-events\/lib\/tribe-community-events-template-tags.php&lt;\/b&gt;, lines 196 and 223, &lt;b&gt;tribe_community_events_form_start_time_selector()&lt;\/b&gt; and &lt;b&gt;tribe_community_events_form_end_time_selector()&lt;\/b&gt;: if ( !strstr( get_option( &#039;time_format&#039;, TribeDateUtils::TIMEFORMAT ), &#039;H&#039; ) ) { &lt;br\/&gt; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-13T15:23:34+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/\",\"name\":\"Wrong 12h\/24h time format detection -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2014-02-26T23:07:47+00:00\",\"dateModified\":\"2014-03-13T15:23:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Wrong 12h\/24h time format detection\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wrong 12h\/24h time format detection -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/","og_locale":"en_US","og_type":"article","og_title":"Wrong 12h\/24h time format detection -","og_description":"Hello.&lt;br\/&gt;&lt;br\/&gt; It seems TEC and Community Events don&#8217;t handle correctly the 24h time format. Seen in &lt;b&gt;the-event-calendar\/lib\/tribe-view-helpers.class.php&lt;\/b&gt;, line 441, &lt;b&gt;TribeEventsViewHelpers::hours()&lt;\/b&gt;: $rangeMax = ( strstr(get_option('time_format', TribeDateUtils::TIMEFORMAT), 'H') ) ? 23 : 12; &lt;br\/&gt; Also seen in &lt;b&gt;the-events-calendar-community-events\/lib\/tribe-community-events-template-tags.php&lt;\/b&gt;, lines 196 and 223, &lt;b&gt;tribe_community_events_form_start_time_selector()&lt;\/b&gt; and &lt;b&gt;tribe_community_events_form_end_time_selector()&lt;\/b&gt;: if ( !strstr( get_option( 'time_format', TribeDateUtils::TIMEFORMAT ), 'H' ) ) { &lt;br\/&gt; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/","article_modified_time":"2014-03-13T15:23:34+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/","name":"Wrong 12h\/24h time format detection -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2014-02-26T23:07:47+00:00","dateModified":"2014-03-13T15:23:34+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/wrong-12h24h-time-format-detection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Wrong 12h\/24h time format detection"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/109855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/109855\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=109855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}