{"id":3383,"date":"2021-06-20T16:33:00","date_gmt":"2021-06-20T07:33:00","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=3383"},"modified":"2021-06-25T16:52:25","modified_gmt":"2021-06-25T07:52:25","slug":"post-3383","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/3383","title":{"rendered":"DateTimePicker\u3067\u7279\u5b9a\u65e5\u306bClass\u3092\u4ed8\u4e0e&#038;\u9078\u629e\u4e0d\u53ef\u306b\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><a href=\"https:\/\/xdsoft.net\/jqplugins\/datetimepicker\/\" target=\"_blank\" rel=\"noopener\">jQuery\u30d7\u30e9\u30b0\u30a4\u30f3\u306eDateTimePiker<\/a>\u3067\u7279\u5b9a\u306e\u65e5\u306bClass\u3092\u4ed8\u4e0e\u3057\u3001\u5c1a\u4e14\u3064\u30ab\u30ec\u30f3\u30c0\u30fc\u304b\u3089\u9078\u629e\u4e0d\u53ef\u306e\u72b6\u614b\u306b\u3057\u305f\u304b\u3063\u305f\u3002jQuery UI\u306eDatepicker\u306a\u3089\u7279\u5b9a\u306e\u65e5\u306bClass\u3092\u4ed8\u4e0e\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u3063\u305f\u70ba\u3001<a href=\"https:\/\/taitan916.info\/blog\/archives\/3380#Class\" target=\"_blank\" rel=\"noopener\">\u904e\u53bb\u8a18\u4e8b<\/a>\u306e\u3088\u3046\u306b\u5bb9\u6613\u306b\u5b9f\u88c5\u3067\u304d\u305f\u304c\u672c\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u306f\u305d\u306e\u3088\u3046\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u7121\u3044\u306e\u3067\u5c11\u3005\u82e6\u52b4\u3057\u305f\u3002\u4ee5\u4e0b\u306b\u5bfe\u5fdc\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"https:\/\/taitan916.info\/sample\/datetimepicker4\/\" target=\"_blank\" rel=\"noopener\">https:\/\/taitan916.info\/sample\/datetimepicker4\/<\/a><\/p>\n<p>\u4e0a\u8a18\u30b5\u30f3\u30d7\u30eb\u3067\u306f2021-07-01\u53ca\u30732021-07-15\u3092\u7279\u5b9a\u65e5\u3068\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30bd\u30fc\u30b9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">\t&lt;script&gt;\r\n\t$(function(){\r\n\r\n\t\t\/\/\u7279\u5b9a\u306e\u65e5\u6307\u5b9a\r\n\t\tconst sample_holiday = [&#039;2021-07-01&#039;, &#039;2021-07-15&#039;];\r\n\r\n\t\t$.datetimepicker.setLocale(&#039;ja&#039;);\r\n\t\t$(&#039;#date&#039;).datetimepicker({\r\n\t\t\ttimepicker:false,\r\n\t\t\tformat: &#039;Y-m-d&#039;, \r\n\t\t\tdisabledDates: sample_holiday, \/\/\u9078\u629e\u4e0d\u53ef\u306e\u65e5\u4ed8\u3092\u6307\u5b9a\r\n\t\t\tformatDate: &#039;Y-m-d&#039;, \r\n\t\t\tscrollMonth : false,\r\n\t\t\tscrollInput : false,\r\n\t\t\tonGenerate: holidayCheck, \r\n\t\t\tonShow: holidayCheck,\r\n\t\t\tonChangeMonth: holidayCheck,\r\n\t\t\tonClose: holidayCheck, \r\n\t\t});\r\n\r\n\t\tfunction holidayCheck(){\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t$(&#039;.xdsoft_calendar td&#039;).each(function(){\r\n\t\t\t\t\tvar $d = $(this);\r\n\t\t\t\t\tvar Y = $d.data(&#039;year&#039;);\r\n\t\t\t\t\tvar M = $d.data(&#039;month&#039;) + 1;\r\n\t\t\t\t\tvar D = $d.data(&#039;date&#039;);\r\n\t\t\t\t\tvar ymd = [Y, (&#039;0&#039; + M).slice(-2), (&#039;0&#039; + D).slice(-2)].join(&#039;-&#039;);\r\n\r\n\t\t\t\t\t\/\/\u7279\u5b9a\u65e5\u306e\u5834\u5408Class\u4ed8\u4e0e\r\n\t\t\t\t\tif( sample_holiday.includes(ymd) ){\r\n\t\t\t\t\t\t$d.addClass(&#039;sample_holiday&#039;);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}, 50);\r\n\t\t}\r\n\r\n\t});\r\n\t&lt;\/script&gt;<\/pre>\n<h3>\u7279\u5b9a\u306e\u65e5\u6307\u5b9a<\/h3>\n<p>\u914d\u5217\u65b9\u5f0f\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u65e5\u4ed8\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">const sample_holiday = [&#039;2021-07-01&#039;, &#039;2021-07-15&#039;];<\/pre>\n<h3>\u30ab\u30ec\u30f3\u30c0\u30fc\u304b\u3089\u9078\u629e\u4e0d\u53ef<\/h3>\n<p>\u30aa\u30d7\u30b7\u30e7\u30f3\u9805\u76ee\u3067\u6307\u5b9a\u53ef\u80fd\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">disabledDates: sample_holiday,<\/pre>\n<h3>Class\u3092\u4ed8\u4e0e<\/h3>\n<p>holidayCheck\u95a2\u6570\u3067\u65e5\u4ed8\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001\u7279\u5b9a\u65e5\u306bClass\u3092\u4ed8\u4e0e\u3057\u3066\u3044\u308b\u3002\u307e\u305f\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u4f5c\u6210\u6642(onGenerate)\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u8868\u793a\u6642(onShow)\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u6708\u5909\u66f4\u6642(onChangeMonth)\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u9589\u3058\u308b\u6642(onClose)\u306bholidayCheck\u95a2\u6570\u3092\u8d70\u3089\u305b\u3066\u3044\u308b\u3002<\/p>\n<p>\u5c1a\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u4f5c\u6210\u30fb\u8868\u793a\u30fb\u6708\u5909\u66f4\u30fb\u9589\u3058\u308b\u969b\u306b\u52d5\u7684\u306bClass\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u3063\u307d\u3044\u306e\u3067\u3001setTimeout\u3067\u5f8c\u304b\u3089Class\u3092\u4ed8\u4e0e\u3059\u308b\u5f62\u306b\u306a\u308b\u3002<\/p>\n<h3>\u5225\u306eClass\u3092\u4ed8\u4e0e\u3057\u305f\u3044\u5834\u5408<\/h3>\n<p>\u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u3060\u3068\u300csample_holiday\u300d\u914d\u5217\u306e\u65e5\u4ed8\u306b\u5bfe\u3057\u3066\u540c\u540d\u306eClass\u3092\u4ed8\u4e0e\u3057\u3066\u3044\u308b\u304c\u3001\u4f8b\u3048\u3070\u540c\u3058\u30ab\u30ec\u30f3\u30c0\u30fc\u5185\u3067\u300cdiscount_day\u300d\u3068\u3044\u3046\u65e5\u4ed8\u306b\u540c\u540d\u306eClass\u3092\u4ed8\u4e0e\u3057\u305f\u3044\u3068\u3044\u3063\u305f\u5834\u5408\u304c\u3042\u3063\u305f\u3068\u3059\u308b\u3002\u305d\u306e\u5834\u5408\u306f\u300cdiscount_day\u300d\u914d\u5217\u3092\u5b9a\u7fa9\u3057\u3001holidayCheck\u95a2\u6570\u5185\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">\/\/\u7279\u5b9a\u65e5\u306e\u5834\u5408Class\u4ed8\u4e0e\r\nif( discount_day.includes(ymd) ){\r\n\t$d.addClass(&#039;discount_day&#039;);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<p>Class\u4ed8\u4e0e\u90e8\u5206\u306f\u591a\u5c11\u529b\u6280\u3063\u307d\u3044\u306e\u3067\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u306a\u3044\u53ef\u80fd\u6027\u3042\u308a\u30022021\u5e746\u6708\u6642\u70b9\u3060\u3068Chrome \/ Edge \/ Firefox\u306f\u52d5\u4f5c\u3057\u305f\u304cIE11\u3067\u306f\u52d5\u4f5c\u3057\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p><a href=\"https:\/\/xdsoft.net\/jqplugins\/datetimepicker\/\" target=\"_blank\" rel=\"noopener\">jQuery\u30d7\u30e9\u30b0\u30a4\u30f3\u306eDateTimePiker<\/a>\u3067\u5bfe\u5fdc\u3059\u308b\u306e\u306f\u82e5\u5e72\u9762\u5012\u306a\u70b9\u3068\u52d5\u4f5c\u304c\u4e0d\u5b89\u5b9a\u306a\u70b9\u3092\u8003\u616e\u3059\u308b\u3068jQuery UI\u3092\u4f7f\u3063\u305f\u65b9\u304c\u7121\u96e3\u3063\u307d\u3044\u3002\u7279\u306b\u52d5\u4f5c\u304c\u4e0d\u5b89\u5b9a\u306a\u70b9\u306f\u5f8c\u3005\u4e0d\u5177\u5408\u5bfe\u5fdc\u7b49\u3067\u6642\u9593\u304c\u53d6\u3089\u308c\u305d\u3046\u3067\u6016\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u53c2\u8003\u30b5\u30a4\u30c8<\/h2>\n<p><a href=\"http:\/\/cmz.wp.xdomain.jp\/archives\/1065\" target=\"_blank\" rel=\"noopener\">http:\/\/cmz.wp.xdomain.jp\/archives\/1065<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery\u30d7\u30e9\u30b0\u30a4\u30f3\u306eDateTimePiker\u3067\u7279\u5b9a\u306e\u65e5\u306bClass\u3092\u4ed8\u4e0e\u3057 ... <\/p>\n","protected":false},"author":1,"featured_media":1071,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-3383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","category-javascript"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=3383"}],"version-history":[{"count":0,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1071"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=3383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=3383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=3383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}