{"id":102,"date":"2021-06-29T16:45:00","date_gmt":"2021-06-29T07:45:00","guid":{"rendered":"https:\/\/javascript.auctionpro.co.kr\/?page_id=102"},"modified":"2022-12-06T09:46:14","modified_gmt":"2022-12-06T00:46:14","slug":"passenger-type-check","status":"publish","type":"page","link":"https:\/\/javascript.auctionpro.co.kr\/?page_id=102","title":{"rendered":"Passenger Type Check"},"content":{"rendered":"\n<p>\uad6d\ub0b4\uc120  \ud0d1\uc2b9\uac1d ADT(13\uc138\uc774\uc0c1) CHD(2\uc138~13\uc138 \ubbf8\ub9cc) INF (2\uc138\ubbf8\ub9cc)  \uc544\ub2c8\uba74 \uacbd\uace0\ucc3d<br>\uad6d\uc81c\uc120\uc740 12\uc138  \uae30\uc900 <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/javascript.auctionpro.co.kr\/wp-content\/uploads\/2021\/06\/ADTCHDINF_Check.jpg\" alt=\"\" class=\"wp-image-103\" width=\"476\" height=\"412\" srcset=\"https:\/\/javascript.auctionpro.co.kr\/wp-content\/uploads\/2021\/06\/ADTCHDINF_Check.jpg 476w, https:\/\/javascript.auctionpro.co.kr\/wp-content\/uploads\/2021\/06\/ADTCHDINF_Check-300x260.jpg 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><figcaption>\ud0d1\uc2b9\uac1d \ub098\uc774\ub97c \uc798\ubabb \uc785\ub825\uc2dc \uacbd\uace0\ucc3d<\/figcaption><\/figure>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \" title=\"Test\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"ko\"&gt;\n&lt;meta charset=\"utf-8\"&gt; \n&lt;body&gt;\n\n&lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.5.1\/jquery.min.js\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n\t\t\/\/ \ud0d1\uc2b9\uac1d \uc0dd\ub144\uc6d4\uc77c \uccb4\ud06c\n\t\tfunction validBirthday(tripType) {\n\t\t\tvar result = true;\n\t\t\tjQuery.each(jQuery(\"input[id*=paxBT]\"), function (i) {\n\t\t\t\tvar birthday = jQuery(this).val();\n\t\t\t\tif (isValidDate(birthday)) { \/** \uc720\ud6a8\ud55c \ub0a0\uc9dc\ud615\uc2dd\uc774\uba74 \uc131\uc778, \uc18c\uc544, \uc720\uc544 \ubcc4 \ub098\uc774\uccb4\ud06c\ud55c\ub2e4. **\/\n\t\t\t\t\tvar ageTypeCode = jQuery(\"#paxType\" + (i + 1)).val();\n\n\t\t\t\t\tfor (var i = 0; i &lt; tripType; i++) {\n\t\t\t\t\t\tvar isValid = ageType(birthday, ageTypeCode, jQuery(\"#depTime\" + (i + 1)).val()); \/\/depTime1 depTime2 hidden\n\t\t\t\t\t\t\n\t\t\t\t\t\t\/\/alert(jQuery(\"#depTime\" + (i + 1)).val());\n\n\t\t\t\t\t\tif (!isValid) {\n\t\t\t\t\t\t\tresult = false;\n\t\t\t\t\t\t\tif (\"CHD\" == ageTypeCode) {\n\t\t\t\t\t\t\t\talert(\"\uc18c\uc544 \ud0d1\uc2b9\uac1d\uc740 \ub9cc 2\uc138 \uc774\uc0c1 ~ \ub9cc 13\uc138 \ubbf8\ub9cc\uc785\ub2c8\ub2e4.\\n\uc785\ub825\ud558\uc2e0 \uc0dd\ub144\uc6d4\uc77c\uc744 \ud655\uc778 \ud574 \uc8fc\uc138\uc694.\");\n\n\t\t\t\t\t\t\t} else if (\"INF\" == ageTypeCode) {\n\t\t\t\t\t\t\t\talert(\"\uc720\uc544 \ud0d1\uc2b9\uac1d\uc740 24\uac1c\uc6d4 \ubbf8\ub9cc\uc785\ub2c8\ub2e4.\\n\uc785\ub825\ud558\uc2e0 \uc0dd\ub144\uc6d4\uc77c\uc744 \ud655\uc778 \ud574 \uc8fc\uc138\uc694.\");\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\talert(\"\uc131\uc778 \ud0d1\uc2b9\uac1d\uc740 \ub9cc 13\uc138 \uc774\uc0c1\uc785\ub2c8\ub2e4.\\n\uc785\ub825\ud558\uc2e0 \uc0dd\ub144\uc6d4\uc77c\uc744 \ud655\uc778\ud574 \uc8fc\uc138\uc694.\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjQuery(this).focus();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tresult = false;\n\t\t\t\t\talert(\"\uc0dd\ub144\uc6d4\uc77c\uc740 YYYYMMDD(19800101)\ub85c \uc785\ub825 \ud574 \uc8fc\uc138\uc694\");\n\t\t\t\t\tjQuery(this).focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn result;\n\t\t}\n\t\t\n\t\t\/\/ \ub098\uc774 \ud0c0\uc785\ubcc4 \uc0dd\ub144\uc6d4\uc77c \uccb4\ud06c\n\t\tfunction ageType(yyyymmdd, ageTypeCode, depdate) {\n\t\t\tvar year = yyyymmdd.substr(0, 4);\n\t\t\tvar month = yyyymmdd.substr(4, 2);\n\t\t\tvar day = yyyymmdd.substr(6, 2);\n\t\t\tvar birthDay = year + \"\" + month + \"\" + day;\n\n\t\t\tvar date = depdate.split(\".\");\n\t\t\tvar depYear = parseInt(date[0], 10),\n\t\t\t\tdepMonth = parseInt(date[1], 10),\n\t\t\t\tdepDay = parseInt(date[2], 10);\n\n\t\t\tif (ageTypeCode == \"ADT\") {\n\t\t\t\t\/\/ todate = 20210825\n\t\t\t\t\/\/ 20080825 \ucd9c\uc0dd\uc790\ubd80\ud130 \uc131\uc778\n\t\t\t\tvar standardAdt = parseInt((depYear - 13) + (\"00\" + depMonth).slice(-2) + (\"00\" + depDay).slice(-2), 10);\n\n\t\t\t\tif (parseInt(birthDay, 10) &lt;= parseInt(standardAdt, 10)) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ageTypeCode == \"CHD\") {\n\t\t\t\t\/\/ todate = 20210825\n\t\t\t\t\/\/ 20080826 \ucd9c\uc0dd ~ 20190825 \ucd9c\uc0dd\n\t\t\t\tvar standardChdFrom = parseInt((depYear - 13) + (\"00\" + depMonth).slice(-2) + (\"00\" + depDay).slice(-2), 10);\n\t\t\t\tvar standardChdTo = parseInt((depYear - 2) + (\"00\" + depMonth).slice(-2) + (\"00\" + depDay).slice(-2), 10);\n\n\t\t\t\tif (parseInt(birthDay, 10) &gt; parseInt(standardChdFrom, 10) &amp;&amp; parseInt(birthDay, 10) &lt;= parseInt(standardChdTo, 10)) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ageTypeCode == \"INF\") {\n\t\t\t\tvar standardInf = parseInt((depYear - 2) + (\"00\" + depMonth).slice(-2) + (\"00\" + depDay).slice(-2), 10);\n\t\t\t\tif (parseInt(birthDay, 10) &gt; parseInt(standardInf, 10)) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\/\/ \ub0a0\uc9dc\uac00 \uc720\ud6a8\ud55c\uc9c0 \uac80\uc0ac\n\t\tfunction isValidDate(value) {\n\t\t\tvar result = true;\n\t\t\ttry {\n\t\t\t\tvar y = value.substr(0, 4);\n\t\t\t\tvar m = value.substr(4, 2);\n\t\t\t\tvar d = value.substr(6, 2);\n\n\t\t\t\tvar dateRegex = \/^(?=\\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\\x20|$))|(?:2[0-8]|1\\d|0?[1-9]))([-.\\\/])(?:1[012]|0?[1-9])\\1(?:1[6-9]|[2-9]\\d)?\\d\\d(?:(?=\\x20\\d)\\x20|$))?(((0?[1-9]|1[012])(:[0-5]\\d){0,2}(\\x20[AP]M))|([01]\\d|2[0-3])(:[0-5]\\d){1,2})?$\/;\n\t\t\t\tresult = dateRegex.test(d + '-' + m + '-' + y);\n\t\t\t} catch (err) {\n\t\t\t\tresult = false;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\t\n&lt;\/script&gt;\n\n\uc5ec\uc8151 \ucd9c\uad6d &lt;input type=\"text\" id=\"depTime1\" value=\"2021.09.10\" \/&gt;&lt;br\/&gt;\n\uc5ec\uc8152 \ucd9c\uad6d &lt;input type=\"text\" id=\"depTime2\" value=\"2021.10.10\" \/&gt;&lt;br\/&gt;\n\uc5ec\uc8153 \ucd9c\uad6d &lt;input type=\"text\" id=\"depTime3\" value=\"2021.11.10\" \/&gt;&lt;br\/&gt;\n&lt;br\/&gt;\nTYPE:&lt;input type=\"text\" id=\"paxType1\" value=\"ADT\"\/&gt;  \uc0dd\ub144\uc6d4\uc77c :  &lt;input type=\"text\" id=\"paxBT1\" value=\"19801212\"\/&gt; &lt;br\/&gt;\nTYPE:&lt;input type=\"text\" id=\"paxType2\" value=\"CHD\"\/&gt;  \uc0dd\ub144\uc6d4\uc77c :  &lt;input type=\"text\" id=\"paxBT2\" value=\"20161212\"\/&gt; &lt;br\/&gt;\nTYPE:&lt;input type=\"text\" id=\"paxType3\" value=\"INF\"\/&gt;  \uc0dd\ub144\uc6d4\uc77c :  &lt;input type=\"text\" id=\"paxBT3\" value=\"20161212\"\/&gt; &lt;br\/&gt;\n&lt;br\/&gt;\n\n&lt;button onclick=\"validBirthday(3)\"&gt; Check  &lt;\/button&gt;\n\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\uad6d\ub0b4\uc120 \ud0d1\uc2b9\uac1d ADT(13\uc138\uc774\uc0c1) CHD(2\uc138~13\uc138 \ubbf8\ub9cc) INF (2\uc138\ubbf8\ub9cc) \uc544\ub2c8\uba74 \uacbd\uace0\ucc3d\uad6d\uc81c\uc120\uc740 12\uc138 \uae30\uc900<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-102","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=102"}],"version-history":[{"count":3,"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/102\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/102\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/javascript.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}