{"id":990,"date":"2018-08-28T04:49:03","date_gmt":"2018-08-27T19:49:03","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=990"},"modified":"2018-08-29T19:31:36","modified_gmt":"2018-08-29T10:31:36","slug":"%e5%85%a889%e9%a0%85%e7%9b%ae%ef%bc%81moment-js%e6%97%a5%e4%bb%98%e3%81%ae%e6%93%8d%e4%bd%9c%ef%bc%86%e6%af%94%e8%bc%83%e3%83%bb%e5%ae%9f%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=990","title":{"rendered":"\u516889\u9805\u76ee\uff01Moment.js\u65e5\u4ed8\u306e\u64cd\u4f5c\uff06\u6bd4\u8f03\u30fb\u5b9f\u4f8b"},"content":{"rendered":"<p>\u3055\u3066\u3001\u524d\u3005\u56de\u306b<a href=\"https:\/\/blog.capilano-fw.com\/?p=908\">\u516861\u4ef6\uff01Moment.js\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5b9f\u4f8b<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u65e5\u4ed8\u3092\u8272\u3005\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u304c\u3001\u5b9f\u306fMoment.js\u306b\u306f\u307e\u3060\u307e\u3060\u4fbf\u5229\u306a\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u4eca\u56de\u306f<\/p>\n<ul>\n<li><strong>\u65e5\u4ed8\u30fb\u6642\u9593\u306e\u64cd\u4f5c\u3000\u30fb\u30fb\u30fb\u3000\u6642\u9593\u3092\u9032\u3081\u305f\u308a\u623b\u3057\u305f\u308a\u3059\u308b<\/strong><\/li>\n<li><strong>\u65e5\u4ed8\u306e\u6bd4\u8f03\u3000\u30fb\u30fb\u30fb\u3000\u524d\u304b\u5f8c\u304b\u540c\u3058\u304b\u306a\u3069\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/strong><\/li>\n<\/ul>\n<p>\u306e\uff12\u70b9\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3057\u3066\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u5408\u308f\u305b\u3066\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-731 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/07\/panda_2.png\" alt=\"\" width=\"149\" height=\"120\" \/><\/p>\n<p><strong>\u5b9f\u884c\u74b0\u5883<\/strong><\/p>\n<p>Moment.js: \u30d0\u30fc\u30b8\u30e7\u30f3 2.22.2<\/p>\n<h1>Add()\u3067\u6642\u9593\u3092\u9032\u3081\u308b<\/h1>\n<h2>\u300c\u6642\u300d\u300c\u5206\u300d\u300c\u79d2\u300d\u306a\u3069\u3092\u6307\u5b9a\u3057\u3066\u6642\u9593\u3092\u9032\u3081\u308b<\/h2>\n<h3>\u5e74\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5\u300d\u304b\u30893\u5e74\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01').<strong>add(3, 'years')<\/strong>; \/\/ <strong>2021\u5e7401\u670801\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>year<\/code>\u3001<code>y<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u6708\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5\u300d\u304b\u3089\uff13\u30f5\u6708\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01').<strong>add(3, 'months')<\/strong>; <strong>\/\/ 2018\u5e7404\u670801\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>month<\/code>\u3001<code>M<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u65e5\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5\u300d\u304b\u3089\uff13\u65e5\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01').<strong>add(3, 'days')<\/strong>; \/\/ <strong>2018\u5e7401\u670804\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>day<\/code>\u3001<code>d<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u6642\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u5206\u300d\u304b\u3089\uff13\u6642\u9593\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00').<strong>add(3, 'hours')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 20:00<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>hour<\/code>\u3001<code>H<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u5206\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u5206\u300d\u304b\u308930\u5206\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00').<strong>add(30, 'minutes')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 17:30<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>minute<\/code>\u3001<code>m<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u79d2\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u520600\u79d2\u300d\u304b\u308930\u79d2\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00:00').<strong>add(30, 'seconds')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 17:00:30<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>second<\/code>\u3001<code>s<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30df\u30ea\u79d2\u3092\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u520600.000\u79d2\u300d\u304b\u308930\u30df\u30ea\u79d2\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00:00.000').<strong>add(3, 'milliseconds')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 17:00:00.030<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>millisecond<\/code>\u3001<code>ms<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\uff14\u534a\u671f\uff08\uff13\u30f5\u6708\uff09\u9032\u3081\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e744\u670815\u65e5\u300d\u304b\u3089\u300c\u56db\u534a\u671f\u300d\u3092\uff11\u3064\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-04-15').<strong>add(1, 'quarters')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>quarter<\/code>\u3001<code>Q<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u6570\u5024\u3092\u6307\u5b9a\u3057\u3066\u6642\u9593\u3092\u9032\u3081\u308b<\/h2>\n<pre>moment('2018-01-01').<strong>add(86400000)<\/strong>; \/\/ \uff11\u65e5\u30022018\u5e741\u67082\u65e5\r\nmoment('2018-01-01 17:00').<strong>add(3600000)<\/strong>; \/\/ 1\u6642\u9593\u30022018\u5e741\u67081\u65e5 18:00\r\nmoment('2018-01-01 17:00').<strong>add(60000)<\/strong>; \/\/ 1\u5206\u30022018\u5e741\u67081\u65e5 17:01\r\nmoment('2018-01-01 17:00:00').<strong>add(1000)<\/strong>; \/\/ 1\u79d2\u30022018\u5e741\u67081\u65e5 17:00:01\r\nmoment('2018-01-01 17:00:00.000').<strong>add(1)<\/strong>; \/\/ 1\u30df\u30ea\u79d2\u30022018\u5e741\u67081\u65e5 17:00:00.001<\/pre>\n<p>\u203b\u6307\u5b9a\u3059\u308b\u6570\u5024\u306f\u300c\u30df\u30ea\u79d2\u300d\u3067\u3059\u3002<\/p>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u5404\u6642\u523b\u3092\u9032\u3081\u308b<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5\u30000\u66420\u52060.000\u79d2\u300d\u304b\u30891\u5e74\u30011\u30f5\u6708\u30011\u5206\u3001\uff11\u6642\u9593\u3001\uff11\u5206\u30011\u79d2\u30011\u30df\u30ea\u79d2\u3092\u305d\u308c\u305e\u308c\u9032\u3081\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 00:00:00.000').<strong>add({<\/strong>\r\n<strong>    years: 1,<\/strong>\r\n<strong>    months: 1,<\/strong>\r\n<strong>    day: 1,<\/strong>\r\n<strong>    hours: 1,<\/strong>\r\n<strong>    minutes: 1,<\/strong>\r\n<strong>    seconds: 1,<\/strong>\r\n<strong>    milliseconds: 1<\/strong>\r\n<strong>});\r\n\r\n\/\/ 2019\u5e742\u67082\u65e5 01:01:01.001<\/strong><\/pre>\n<h1>subtract()\u3067\u6642\u9593\u3092\u623b\u3059<\/h1>\n<h2>\u300c\u6642\u300d\u300c\u5206\u300d\u300c\u79d2\u300d\u306a\u3069\u3092\u6307\u5b9a\u3057\u3066\u6642\u9593\u3092\u623b\u3059<\/h2>\n<h3>\u5e74\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5\u300d\u304b\u3089\uff13\u5e74\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01').<strong>subtract(3, 'years')<\/strong>; \/\/ <strong>2015\u5e7401\u670801\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>year<\/code>\u3001<code>y<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u6708\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e7412\u67081\u65e5\u300d\u304b\u3089\uff13\u30f5\u6708\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-12-01').<strong>subtract(3, 'months')<\/strong>; <strong>\/\/ 2018\u5e749\u67081\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>month<\/code>\u3001<code>M<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u65e5\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u670831\u65e5\u300d\u304b\u3089\uff13\u65e5\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-31').<strong>subtract(3, 'days')<\/strong>; \/\/ <strong>2018\u5e741\u670828\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>day<\/code>\u3001<code>d<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u6642\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u5206\u300d\u304b\u3089\uff13\u6642\u9593\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00').<strong>subtract(3, 'hours')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 14:00<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>hour<\/code>\u3001<code>H<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u5206\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u5206\u300d\u304b\u308930\u5206\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00').<strong>subtract(30, 'minutes')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 16:30<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>minute<\/code>\u3001<code>m<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u79d2\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u520600\u79d2\u300d\u304b\u308930\u79d2\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00:00').<strong>subtract(3, 'seconds')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 16:59:57<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>second<\/code>\u3001<code>s<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30df\u30ea\u79d2\u3092\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e741\u67081\u65e5 17\u664200\u520600.000\u79d2\u300d\u304b\u308930\u30df\u30ea\u79d2\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01 17:00:00.000').<strong>subtract(3, 'milliseconds')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5 16:59:59.997<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>millisecond<\/code>\u3001<code>ms<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\uff14\u534a\u671f\uff08\uff13\u30f5\u6708\uff09\u623b\u3059<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e744\u670815\u65e5\u300d\u304b\u3089\u300c\u56db\u534a\u671f\u300d\u3092\uff11\u3064\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-04-15').<strong>subtract(1, 'quarters')<\/strong>; \/\/ <strong>2018\u5e741\u670815\u65e5<\/strong><\/pre>\n<p>\u6307\u5b9a\u6587\u5b57\u306f<code>quarter<\/code>\u3001<code>Q<\/code>\u3067\u3082\u540c\u3058\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u6570\u5024\u3092\u6307\u5b9a\u3057\u3066\u6642\u9593\u3092\u623b\u3059<\/h2>\n<pre>moment('2018-01-01').<strong>subtract(86400000)<\/strong>; \/\/ \uff11\u65e5\u30022017\u5e7412\u670831\u65e5\r\nmoment('2018-01-01 17:00').<strong>subtract(3600000)<\/strong>; \/\/ 1\u6642\u9593\u30022018\u5e741\u67081\u65e5 16:00\r\nmoment('2018-01-01 17:00').<strong>subtract(60000)<\/strong>; \/\/ 1\u5206\u30022018\u5e741\u67081\u65e5 16:59\r\nmoment('2018-01-01 17:00:00').<strong>subtract(1000)<\/strong>; \/\/ 1\u79d2\u30022018\u5e741\u67081\u65e5 16:59:59\r\nmoment('2018-01-01 17:00:00.000').<strong>subtract(1)<\/strong>; \/\/ 1\u30df\u30ea\u79d2\u30022018\u5e741\u67081\u65e5 16:59:59.999<\/pre>\n<p>\u203b\u6307\u5b9a\u3059\u308b\u6570\u5024\u306f\u300c\u30df\u30ea\u79d2\u300d\u3067\u3059\u3002<\/p>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u5404\u6642\u523b\u3092\u623b\u3059<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2011\u5e7411\u670811\u65e5\u300011\u664211\u520611.111\u79d2\u300d\u304b\u30891\u5e74\u30011\u30f5\u6708\u30011\u5206\u3001\uff11\u6642\u9593\u3001\uff11\u5206\u30011\u79d2\u30011\u30df\u30ea\u79d2\u3092\u305d\u308c\u305e\u308c\u623b\u3059\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2011-11-11 11:11:11.111').<strong>subtract({<\/strong>\r\n<strong>    years: 1,<\/strong>\r\n<strong>    months: 1,<\/strong>\r\n<strong>    day: 1,<\/strong>\r\n<strong>    hours: 1,<\/strong>\r\n<strong>    minutes: 1,<\/strong>\r\n<strong>    seconds: 1,<\/strong>\r\n<strong>    milliseconds: 1<\/strong>\r\n<strong>});\r\n\r\n\/\/ 2010\u5e7410\u670810\u65e5 10:10:10.110<\/strong><\/pre>\n<h1>startOf()\u3067\u958b\u59cb\u5834\u6240\u3092\u6307\u5b9a\u3057\u3066\u79fb\u52d5\u3055\u305b\u308b<\/h1>\n<h2>\u5e74\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u67081\u65e5\u300d\u304b\u3089\u5e74\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-01').<strong>startOf('year')<\/strong>; \/\/ <strong>2018\u5e741\u67081\u65e5<\/strong><\/pre>\n<h2>\u6708\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5\u300d\u304b\u3089\u6708\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15').<strong>startOf('month')<\/strong>; \/\/ <strong>2018\u5e747\u67081\u65e5<\/strong><\/pre>\n<h2>\u65e5\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664200\u5206\u300d\u304b\u3089\u6708\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:00').<strong>startOf('day')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 00:00<\/strong><\/pre>\n<h2>\u6642\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u5206\u300d\u304b\u3089\u6642\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33').<strong>startOf('hour')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:00<\/strong><\/pre>\n<h2>\u5206\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u520644\u79d2\u300d\u304b\u3089\u5206\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33:44').<strong>startOf('minute')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:33:00<\/strong><\/pre>\n<h2>\u79d2\u306e\u59cb\u3081\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u520644.555\u79d2\u300d\u304b\u3089\u79d2\u306e\u59cb\u3081\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33:44.555').<strong>startOf('second')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:33:44.000<\/strong><\/pre>\n<h1>endOf()\u3067\u7d42\u4e86\u5834\u6240\u3092\u6307\u5b9a\u3057\u3066\u79fb\u52d5\u3055\u305b\u308b<\/h1>\n<h2>\u5e74\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u67081\u65e5\u300d\u304b\u3089\u5e74\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-01').<strong>endOf('year')<\/strong>; \/\/ <strong>2018\u5e7412\u670831\u65e5<\/strong><\/pre>\n<h2>\u6708\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5\u300d\u304b\u3089\u6708\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15').<strong>endOf('month')<\/strong>; \/\/ <strong>2018\u5e747\u670831\u65e5<\/strong><\/pre>\n<h2>\u65e5\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664200\u5206\u300d\u304b\u3089\u6708\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:00').<strong>endOf('day')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 23:59<\/strong><\/pre>\n<h2>\u6642\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u5206\u300d\u304b\u3089\u6642\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33').<strong>endOf('hour')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:59<\/strong><\/pre>\n<h2>\u5206\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u520644\u79d2\u300d\u304b\u3089\u5206\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33:44').<strong>endOf('minute')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:33:59<\/strong><\/pre>\n<h2>\u79d2\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u300c2018\u5e747\u670815\u65e5 17\u664233\u520644.555\u79d2\u300d\u304b\u3089\u79d2\u306e\u7d42\u308f\u308a\u306b\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre>moment('2018-07-15 17:33:44.555').<strong>endOf('second')<\/strong>; \/\/ <strong>2018\u5e747\u670815\u65e5 17:33:44.999<\/strong><\/pre>\n<h1 id=\"is_before\">isBefore()\u3067\u524d\u306e\u6642\u9593\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-01').<strong>isBefore('2018-01-02');<\/strong> \/\/ <strong>true\r\n\r\n<\/strong>moment('2018-01-01').<strong>isBefore(1514818800000);<\/strong> \/\/ <strong>true, <\/strong>1514818800000 \u306f 2018\/01\/02\r\n\r\nvar dt = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 1, \/\/ 2\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-01').<strong>isBefore(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<p>\u203bisBefore()\u306f\u540c\u3058\u65e5\u6642\u306f<code>false<\/code>\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u540c\u3058\u65e5\u6642\u3082\u542b\u3081\u305f\u3044\u5834\u5408\u306f<a href=\"#is_same_before\">isSameOrBefore()<\/a>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u5e74\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2017-01-01').<strong>isBefore('2018-01-01', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-04-01').<strong>isBefore('2018-05-01', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01').<strong>isBefore('2018-05-02', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:00').<strong>isBefore('2018-05-01 18:00', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30').<strong>isBefore('2018-05-01 17:35', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3001\u79d2\u3067\u524d\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:15').<strong>isBefore('2018-05-01 17:30:20', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1>isSame()\u3067\u540c\u3058\u6642\u9593\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-01').<strong>isSame('2018-01-01')<\/strong>; \/\/ <strong>true\r\n<\/strong>\r\nmoment('2018-01-01').<strong>isSame(1514732400000)<\/strong>; \/\/ <strong>true<\/strong>, 1514732400000 \u306f 2018-01-01\r\n\r\nvar dt = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 0, \/\/ 1\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-01').<strong>isSame(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-01-01').<strong>isSame('2018-02-02', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01').<strong>isSame('2018-05-31', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01').<strong>isSame('2018-05-01', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:01').<strong>isSame('2018-05-01 17:59', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:01').<strong>isSame('2018-05-01 17:30:59', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3001\u79d2\u3067\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:15.111').<strong>isSame('2018-05-01 17:30:15.222', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1 id=\"is_after\">isAfter()\u3067\u5f8c\u306e\u6642\u9593\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-02').<strong>isAfter('2018-01-01');<\/strong> \/\/ <strong>true\r\n\r\n<\/strong>moment('2018-01-02').<strong>isAfter(1514732400000);<\/strong> \/\/ <strong>true, <\/strong>1514732400000 \u306f 2018\/01\/01\r\n\r\nvar dt = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 0, \/\/ 1\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-02').<strong>isAfter(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<p>\u203bisAfter()\u306f\u540c\u3058\u65e5\u6642\u306f<code>false<\/code>\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u540c\u3058\u65e5\u6642\u3082\u542b\u3081\u305f\u3044\u5834\u5408\u306f<a href=\"#is_same_after\">isSameOrAfter()<\/a>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u5e74\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2019-01-01').<strong>isAfter('2018-01-01', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-06-01').<strong>isAfter('2018-05-01', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-02').<strong>isAfter('2018-05-01', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 18:00').<strong>isAfter('2018-05-01 17:00', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:35').<strong>isAfter('2018-05-01 17:30', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3001\u79d2\u3067\u5f8c\u306e\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:25').<strong>isAfter('2018-05-01 17:30:15', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1 id=\"is_same_before\">isSameOrBefore()\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-01').<strong>isSameOrBefore('2018-01-02');<\/strong> \/\/ <strong>true\r\n\r\n<\/strong>moment('2018-01-01').<strong>isSameOrBefore(1514818800000);<\/strong> \/\/ <strong>true, <\/strong>1514818800000 \u306f 2018\/01\/02\r\n\r\nvar dt = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 1, \/\/ 2\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-01').<strong>isSameOrBefore(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<p>\u203bisSameOrBefore()\u306f\u540c\u3058\u65e5\u6642\u3067\u3082<code>true<\/code>\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u540c\u3058\u65e5\u6642\u3082\u9664\u5916\u3057\u305f\u3044\u5834\u5408\u306f<a href=\"#is_before\">isBefore()<\/a>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u5e74\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2017-01-01').<strong>isSameOrBefore('2018-01-01', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-04-01').<strong>isSameOrBefore('2018-05-01', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01').<strong>isSameOrBefore('2018-05-02', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:00').<strong>isSameOrBefore('2018-05-01 18:00', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30').<strong>isSameOrBefore('2018-05-01 17:35', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3001\u79d2\u3067\u524d\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:15').<strong>isSameOrBefore('2018-05-01 17:30:20', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1 id=\"is_same_after\">isSameOrAfter()\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-02').<strong>isSameOrAfter('2018-01-01');<\/strong> \/\/ <strong>true\r\n\r\n<\/strong>moment('2018-01-02').<strong>isSameOrAfter(1514732400000);<\/strong> \/\/ <strong>true, <\/strong>1514732400000 \u306f 2018\/01\/01\r\n\r\nvar dt = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 0, \/\/ 1\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-02').<strong>isSameOrAfter(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<p>\u203bisSameOrAfter()\u306f\u540c\u3058\u65e5\u6642\u3067\u3082<code>true<\/code>\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u3057\u3001\u540c\u3058\u65e5\u6642\u3082\u9664\u5916\u3057\u305f\u3044\u5834\u5408\u306f<a href=\"#is_before\">isAfter()<\/a>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u5e74\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2019-01-01').<strong>isSameOrAfter('2018-01-01', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-06-01').<strong>isSameOrAfter('2018-05-01', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-02').<strong>isSameOrAfter('2018-05-01', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 18:00').<strong>isSameOrAfter('2018-05-01 17:00', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:35').<strong>isSameOrAfter('2018-05-01 17:30', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3001\u6708\u3001\u65e5\u3001\u6642\u3001\u5206\u3001\u79d2\u3067\u5f8c\u306e\u6642\u9593\u3001\u3082\u3057\u304f\u306f\u540c\u3058\u6642\u9593\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:25').<strong>isSameOrAfter('2018-05-01 17:30:15', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1>isBetween()\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-01-02').<strong>isBetween('2018-01-01', '2018-01-03')<\/strong>; \/\/ <strong>true<\/strong>\r\n\r\nmoment('2018-01-02').<strong>isBetween(1514732400000, 1514905200000)<\/strong>; \/\/ true, 1514732400000 \u306f 2018-01-01\u30011514905200000 \u306f 2018-01-03\r\n\r\nvar dt1 = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 0, \/\/ 1\u6708<\/strong>\r\n<strong>    day: 1<\/strong>\r\n<strong>})<\/strong>;\r\nvar dt2 = <strong>moment({<\/strong>\r\n<strong>    year: 2018,<\/strong>\r\n<strong>    month: 0, \/\/ 1\u6708<\/strong>\r\n<strong>    day: 3<\/strong>\r\n<strong>})<\/strong>;\r\nmoment('2018-01-02').<strong>isBetween(dt1, dt2)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5e74\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-01-01').<strong>isBetween('2017-01-01', '2019-01-01', 'year')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u6708\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-06-01').<strong>isBetween('2018-05-01', '2018-07-01', 'month')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u65e5\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-02').<strong>isBetween('2018-05-01', '2018-05-03', 'day')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u6642\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:00').<strong>isBetween('2018-05-01 16:00', '2018-05-01 18:00', 'hour')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u5206\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:33').<strong>isBetween('2018-05-01 17:30', '2018-05-01 17:35', 'minute')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>\u79d2\u3067\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af<\/h2>\n<pre>moment('2018-05-01 17:30:25').<strong>isBetween('2018-05-01 17:30:15', '2018-05-01 17:30:35', 'second')<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h2>isBetween()\u306e\u540c\u3058\u5024\u3092\u542b\u3081\u308b\u304b\u9664\u53bb\u3059\u308b\u304b\u306e\u30aa\u30d7\u30b7\u30e7\u30f3<\/h2>\n<p>isBetween()\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u4e0d\u7b49\u5f0f\u306e\u3088\u3046\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u6307\u5b9a\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>A\u3000&lt;\u3000B\u3000&lt; C<\/code><\/li>\n<li><code>A\u3000&lt;=\u3000B\u3000&lt;\u3000C<\/code><\/li>\n<li><code>A\u3000&lt;\u3000B\u3000&lt;=\u3000C<\/code><\/li>\n<li><code>A\u3000&lt;=\u3000B\u3000&lt;=\u3000C<\/code><\/li>\n<\/ul>\n<p>\u4f7f\u3044\u65b9\u306f\u7b2c\uff14\u5f15\u6570\u306b\u4ee5\u4e0b\uff14\u3064\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u6307\u5b9a\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<ol>\n<li><code><strong>(<\/strong><\/code>\u3000\u30fb\u30fb\u30fb\u3000\u672a\u6e80\u3002\u300c\uff1c\u300d<\/li>\n<li><code><strong>)<\/strong><\/code>\u3000\u30fb\u30fb\u30fb\u3000\u8d85\u3002\u300c\uff1c\u300d<\/li>\n<li><code><strong>[<\/strong><\/code>\u3000\u30fb\u30fb\u30fb\u3000\u4ee5\u4e0b\u3002\u300c\uff1c\uff1d\u300d<\/li>\n<li><code><strong>]<\/strong><\/code>\u3000\u30fb\u30fb\u30fb\u3000\u4ee5\u4e0a\u3002\u300c\uff1e\uff1d\u300d<\/li>\n<\/ol>\n<p>\u5b9f\u969b\u306e\u4f8b\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>A &lt; B &lt; C<\/h3>\n<pre>moment('2018-01-01').isBetween('2018-01-01', '2018-02-01', null, <strong>'()'<\/strong>); \/\/ <strong>false<\/strong><\/pre>\n<h3>A &lt;= B &lt; C<\/h3>\n<pre>moment('2018-01-01').isBetween('2018-01-01', '2018-02-01', null, <strong>'[)'<\/strong>); \/\/ <strong>true<\/strong><\/pre>\n<h3>A &lt; B &lt;= C<\/h3>\n<pre>moment('2018-07-01').isBetween('2018-01-01', '2018-07-01', null, <strong>'(]'<\/strong>); \/\/ <strong>true<\/strong><\/pre>\n<h3>A &lt;= B &lt;= C<\/h3>\n<pre>moment('2018-07-01').isBetween('2018-07-01', '2018-12-01', null, <strong>'[]'<\/strong>); \/\/ <strong>true<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7bc4\u56f2\u306e\u958b\u59cb\u30fb\u7d42\u4e86\u3069\u3061\u3089\u304b\u304c<code>false<\/code>\u3068\u306a\u308b\u5834\u5408\u3001\u5168\u4f53\u306e\u8a55\u4fa1\u306f\u540c\u3058\u304f<code>false<\/code>\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre>moment('2018-01-01').isBetween('2018-01-01', '2018-01-01', null, <strong>'(]'<\/strong>); \/\/ <strong>false<\/strong><\/pre>\n<h1>isDST()\u3067\u30b5\u30de\u30fc\u30bf\u30a4\u30e0\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2018-12-01').<strong>isDST()<\/strong>; \/\/ <strong>false<\/strong><\/pre>\n<p>\u203b\u65e5\u672c\u8a9e\u74b0\u5883\u3067\u306f\u3069\u306e\u65e5\u4ed8\u3067\u3082\u300ctrue\u300d\u306b\u306f\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<h1>isLeapYear()\u3067\u3046\u308b\u3046\u5e74\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>moment('2020-01-01').<strong>isLeapYear()<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1>isMoment()\u3067MomentJS\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>var dt = moment();\r\n<strong>moment.isMoment(dt)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1>isDate()\u3067Date\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/h1>\n<pre>var date = new Date();\r\n<strong>moment.isDate(date)<\/strong>; \/\/ <strong>true<\/strong><\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u4eca\u56de\u306e\u307e\u3068\u3081\u3067\u4fbf\u5229\u3055\u3092\u518d\u5b9f\u611f\u3057\u305f\u306e\u306f\u3001isBetween()\u3067\u300c\u305d\u308c\u305e\u308c\u306e\u7bc4\u56f2\u3092\u542b\u3081\u308b\u304b\u3069\u3046\u304b\u300d\u3092\u6307\u5b9a\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p>\u78ba\u304b\u306b\u3001isSameOrBefore()\u306e\u3088\u3046\u306b\u30e1\u30bd\u30c3\u30c9\u540d\u306b\u3059\u308b\u306b\u306f\u9577\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3057\u3001\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4f5c\u8005\u3068\u3057\u3066\u3082\u3069\u3046\u3059\u308b\u304b\u8ff7\u3044\u3069\u3053\u308d\u3060\u3063\u305f\u306f\u305a\u3067\u3059\u304c\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u4f7f\u3046\u3068\u3044\u3046\u30a2\u30a4\u30c7\u30a2\u306f\u76f4\u611f\u7684\u3067\u3059\u3057\u3068\u3066\u3082\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u3084\u306f\u308a\u512a\u308c\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5b66\u3076\u3053\u3068\u306f\u30b9\u30ad\u30eb\u5411\u4e0a\u306b\u3082\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u307e\u3060\u8aac\u660e\u3067\u304d\u3066\u3044\u306a\u3044Moment.js\u306e\u4fbf\u5229\u6a5f\u80fd\u304c\u6b8b\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4eca\u5f8c\u3082\u6a5f\u4f1a\u3092\u307f\u3066\u305d\u3061\u3089\u306e\u90e8\u5206\u3082\u8a18\u4e8b\u306b\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3054\u671f\u5f85\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-519 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21.png\" alt=\"\" width=\"192\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21.png 192w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/05\/21-180x300.png 180w\" sizes=\"auto, (max-width: 192px) 100vw, 192px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3001\u524d\u3005\u56de\u306b\u516861\u4ef6\uff01Moment.js\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5b9f\u4f8b\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u65e5\u4ed8\u3092\u8272\u3005\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u304c\u3001\u5b9f\u306f &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=990\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u516889\u9805\u76ee\uff01Moment.js\u65e5\u4ed8\u306e\u64cd\u4f5c\uff06\u6bd4\u8f03\u30fb\u5b9f\u4f8b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":1010,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[78],"class_list":["post-990","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-moment-js"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=990"}],"version-history":[{"count":38,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/990\/revisions"}],"predecessor-version":[{"id":1049,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/990\/revisions\/1049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/1010"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}