{"id":14683,"date":"2021-10-10T10:07:34","date_gmt":"2021-10-10T01:07:34","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=14683"},"modified":"2023-05-27T20:51:43","modified_gmt":"2023-05-27T11:51:43","slug":"%e3%80%90javascript%e3%80%91%e6%99%82%e9%96%93%e6%93%8d%e4%bd%9c%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=14683","title":{"rendered":"\u3010JavaScript\u3011\u6642\u9593\u64cd\u4f5c\u30e9\u30a4\u30d6\u30e9\u30ea\u6bd4\u8f03(Date\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3001Moment\u3001Luxon\u3001js-Joda\u3001day.js\u3001date-fns\u3001Temporal)"},"content":{"rendered":"<h2>\u7d50\u8ad6<\/h2>\n<p>2023\u5e74\u73fe\u5728\u306e\u30d5\u30a1\u30fc\u30b9\u30c8\u30c1\u30e7\u30a4\u30b9\u3068\u3057\u3066\u306f<span style=\"color: #ff0000;\"><strong>\u300cdate-fns\u300d<\/strong><\/span>\u304c\u9078\u629e\u80a2\u306b\u4e0a\u304c\u308a\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u4eca\u5f8c\u306fTemporal\u304cECMA\u6a19\u6e96\u306b\u306a\u3063\u305f\u5834\u5408\u306f\u3053\u3061\u3089\u3092\u4f7f\u3063\u3066\u3044\u304f\u3053\u3068\u304c\u4e88\u6e2c\u3055\u308c\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>Date\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n<p>Java1.0\u306eDate\u3092\u53c2\u8003\u306b\u3057\u3066\u4f5c\u3089\u308c\u305f\u3002\u672c\u5bb6\u306eJava\u3067\u306f1.1\u3067\u307b\u3068\u3093\u3069\u975e\u63a8\u5968\u306b\u306a\u3063\u305f\u304cJavaScript\u3067\u306f\u3044\u307e\u3060\u306bJava\u3067\u975e\u63a8\u5968\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u4f7f\u308f\u308c\u3066\u3044\u308b\u3002<\/p>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>0index\u304c\u4f7f\u308f\u308c\u308b\u3002(+1\u304c\u5fc5\u8981\uff09<\/li>\n<li>\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u304c\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>\u30d5\u30a9\u30fc\u30de\u30c3\u30c8<\/h3>\n<p>\u6708\u306f1\u6708\u30920\u3068\u3057\u3066\u6271\u3046\u306e\u3067+1\u3059\u308b\u5fc5\u8981\u3082\u3042\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">const d = new Date();\r\nconsole.log(\r\n  'date-format',\r\n  `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`\r\n);<\/pre>\n<h2>moment<\/h2>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>\u6570\u5e74\u524d\u307e\u3067\u306fDate\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f7f\u3044\u3065\u3089\u3044\u306e\u3067\u3053\u308c\u3092\u4f7f\u3046\u306e\u304c\u4e00\u822c\u7684\u3067\u3057\u305f\u3002<\/li>\n<li>\u7ffb\u8a33\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3080\u306e\u3067\u30d3\u30eb\u30c9\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3059\u304e\u308b\u3053\u3068\u304cFE\u754c\u9688\u3067\u306f\u6709\u540d\u306a\u8a71<\/li>\n<li>2023\u5e74\u73fe\u5728\u306f\u65b0\u898f\u958b\u767a\u306f\u505c\u6b62\u3057\u3066\u3044\u3066\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30e2\u30fc\u30c9\u306b\u5165\u3063\u305f\u306e\u3067\u5225\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u308b\u3002<\/li>\n<\/ul>\n<h3>\u901a\u5e38\u306eDate\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u6bd4\u3079\u3066\u3067\u304d\u308b\u3053\u3068<\/h3>\n<h4>add\u306a\u3069\u306e\u65e5\u4ed8\u8a08\u7b97<\/h4>\n<h4>\u65e5\u4ed8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u4fbf\u5229<\/h4>\n<p>Date\u306b\u6bd4\u3079\u3066\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u697d<\/p>\n<pre class=\"lang:default decode:true\">const moment = require('moment');\r\nconsole.log('moment-format', moment().format('YYYY-MM-DD'));\r\n<\/pre>\n<h2>day.js<\/h2>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>moment\u3068\u540c\u3058API\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u306e\u306b\u3001moment\u306b\u6bd4\u3079\u3066\u30d3\u30eb\u30c9\u30b5\u30a4\u30ba\u304c\u5c0f\u3055\u3044\u306e\u3067moment\u304b\u3089day.js\u306b\u79fb\u884c\u3059\u308b\u73fe\u5834\u304c\u5897\u3048\u3066\u3044\u308b\u3002<\/li>\n<li>moment\u3092\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3053\u308c\u3092\u4f7f\u3046\u3079\u304d\u3002<\/li>\n<li>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>\u307b\u307cJavaScript\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002\uff08TypeScript\u304c\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\uff09<\/li>\n<\/ul>\n<h3>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li>\u56db\u5247\u6f14\u7b97\u51e6\u7406\u3092\u66f8\u3044\u305f\u5834\u5408\u306e\u30d3\u30eb\u30c9\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3044\u3002\uff08\u306a\u306e\u3067\u3001\u4eca\u5f8cTemporal\u304cECMA\u6a19\u6e96\u306b\u306a\u3063\u305f\u5834\u5408\u306fTemporal\u306b\u79fb\u884c\u3057\u305f\u65b9\u304c\u826f\u3044\u3089\u3057\u3044\uff09<\/li>\n<\/ul>\n<h2>js-Joda<\/h2>\n<p>Java\u3092\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u3068\u5229\u70b9\u304c\u3042\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u306e\u3067\u3001\u57fa\u672c\u7684\u306b\u306f\u3053\u308c\u306f\u9078\u629e\u80a2\u306b\u306f\u5165\u3089\u306a\u3044\u306e\u304b\u306a\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/p>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>Java\u7cfb\u30e9\u30a4\u30d6\u30e9\u30ea\uff08java.time\u3001Joda-Time\u3001\u307e\u305f\u306fNoda Time\uff09\u3092\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u4eba\u306f\u3053\u308c\u3092\u4f7f\u3046\u3079\u304d\u3002<\/li>\n<\/ul>\n<h2>Luxon<\/h2>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>\u72ec\u81ea\u306eDateTime\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u308a\u56de\u3059\u5f62\u306b\u306a\u3063\u3066\u304a\u308a\u3001\u305d\u306e\u6069\u6075\u3067\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306e\u64cd\u4f5c\u304c\u304b\u306a\u308a\u76f4\u611f\u7684<\/li>\n<li>\u4f7f\u3044\u52dd\u624b\u306f\u30a4\u30de\u30a4\u30c1\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>date-fns<\/h2>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>day.js\u3068\u3088\u304f\u6bd4\u8f03\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>moment\u306b\u6163\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u3053\u308c\u3082\u9078\u629e\u80a2\u306b\u4e0a\u304c\u308a\u307e\u3059\u3002<\/li>\n<li>\u95a2\u6570\u578b\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>\u307b\u307cTypeScript\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>Temporal<\/h2>\n<p>ECMAScript\u3092\u7b56\u5b9a\u3057\u3066\u3044\u308bTC39\u304c\u65b0\u3057\u304f\u4ed5\u69d8\u3092\u63d0\u6848\u3057\u3066\u3044\u308b\u3002moment\u3084date-fns\u306b\u6bd4\u3079\u3066\u6bd4\u8f03\u7684\u65b0\u3057\u3081\u306eJavaScript\u65e5\u4ed8\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u306a\u308a\u307e\u3059\u3002\u4ed6\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u7570\u306a\u308a<span style=\"color: #ff0000;\"><strong>JavaScript\u306eAPI\u305d\u306e\u3082\u306e(Date\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\u3092\u898b\u76f4\u3059\u3079\u304d\u3060<\/strong><\/span>\u3068\u3044\u3046\u767a\u60f3\u306e\u5143\u3067\u958b\u767a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/h3>\n<p>https:\/\/tc39.es\/proposal-temporal\/docs\/ja\/index.html<\/p>\n<h3>\u7279\u5fb4<\/h3>\n<ul>\n<li>\u6b63\u78ba<\/li>\n<li>\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3084\u5225\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u3082\u6271\u3048\u308b\u3002<\/li>\n<li>\u4f7f\u3044\u3084\u3059\u3044<\/li>\n<li>\u5c06\u6765\u7684\u306bECMA\u6a19\u6e96\u306b\u306a\u308b\u4e88\u5b9a<\/li>\n<li>\u30a4\u30df\u30e5\u30fc\u30bf\u30d6\u30eb\u306a\u306e\u3067\u5f8c\u304b\u3089\u6642\u523b\u306e\u5909\u66f4\u304c\u3067\u304d\u306a\u3044\u3002<\/li>\n<\/ul>\n<h3>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li>\u307e\u3060\u3001ECMA\u6a19\u6e96\u3067\u306f\u306a\u3044\u306e\u3067\u3082\u3057\u4f7f\u3046\u3068\u3057\u3066\u3082polyfill\u304c\u5fc5\u8981\u306b\u306a\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30d5\u30a9\u30fc\u30de\u30c3\u30c8<\/h3>\n<p>\u3042\u307e\u308a\u5f37\u304f\u306a\u3044\u3089\u3057\u3044\u306e\u3067\u3001\u5f15\u304d\u7d9a\u304d\u4ed6\u306e\u30e9\u30a4\u30d6\u30e9\u30ea(moment\u3001day.js\u306a\u3069)\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u9078\u629e\u80a2\u306b\u5165\u308b\u3089\u3057\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u7d50\u8ad6 2023\u5e74\u73fe\u5728\u306e\u30d5\u30a1\u30fc\u30b9\u30c8\u30c1\u30e7\u30a4\u30b9\u3068\u3057\u3066\u306f\u300cdate-fns\u300d\u304c\u9078\u629e\u80a2\u306b\u4e0a\u304c\u308a\u305d\u3046\u3067\u3059\u3002 \u305f\u3060\u3001\u4eca\u5f8c\u306fTemporal\u304cECMA\u6a19\u6e96\u306b\u306a\u3063\u305f\u5834\u5408\u306f\u3053\u3061\u3089\u3092\u4f7f\u3063\u3066\u3044\u304f\u3053\u3068\u304c\u4e88\u6e2c\u3055\u308c\u305d\u3046\u3067\u3059\u3002 Date\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 J [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14683"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14683"}],"version-history":[{"count":28,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14683\/revisions"}],"predecessor-version":[{"id":20268,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/14683\/revisions\/20268"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14683"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}