{"id":7541,"date":"2022-12-22T12:46:46","date_gmt":"2022-12-22T07:16:46","guid":{"rendered":"https:\/\/innovationm.co\/?p=7541"},"modified":"2022-12-22T12:46:46","modified_gmt":"2022-12-22T07:16:46","slug":"only-date-you-need-to-go-on-a-js-developer-version","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/","title":{"rendered":"Only Date() you need to go on (A JS developer version)"},"content":{"rendered":"<p>As you already know everything in JavaScript is an object. One of the objects is so weird in JavaScript called Date(). Today, even experienced devs get nervous with Date() and reach for libraries like &#8216;date-fns&#8217; and &#8216;moment&#8217;.<\/p>\n<p>Yes, you read it at the right moment. which is the most popular library while struggling with date and time.<\/p>\n<p>I personally used it many times in my projects and many date-picker libraries like &#8216;RC-date-picker&#8217; depends on the moment. as it takes the moment object as a value and returns the same.<\/p>\n<p>But, today we are not talking about any third-party library. We will be learning how to date, obviously in JavaScript. \ud83d\ude09<\/p>\n<p>Date() can be quite simple if you know how to deal with it. I&#8217;ll walk you through some simple implementations of Date() throughout this blog.<\/p>\n<p>first, let&#8217;s take brief knowledge about time zones:<\/p>\n<p><strong>Time zones: &#8211;<\/strong><\/p>\n<p>Around the world, there are several time zones. however, with JavaScript, only two of them are important &#8211; 1) Local Time and 2) Coordinated Universal Time (UTC).<\/p>\n<p>1) Local Time &#8211; It refers to the current time zone in which our computer is right.<\/p>\n<p>2) UTC &#8211; It is like GMT &#8211; which stands for Greenwich mean time. (Technically both are the same)<\/p>\n<p>By default, JavaScript Date() object returns local time. but it returns UTC when we specify the same.<\/p>\n<p><strong>How to create a date:<\/strong><\/p>\n<p>we can create a date with a new Date() method and there are four ways to create a date using a new Date().<\/p>\n<ol>\n<li>Date string method.<\/li>\n<li>Passing arguments method.<\/li>\n<li>Timestamp method.<\/li>\n<li>No arguments method.<\/li>\n<\/ol>\n<p><strong>1.) <\/strong><strong>Date string method: &#8211;<\/strong><\/p>\n<p>In this method, you can create a date by passing a date string in the new Date().<\/p>\n<p><img decoding=\"async\" class=\"alignnone  wp-image-7542\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b1-300x18.png\" alt=\"\" width=\"417\" height=\"25\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b1-300x18.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b1-1024x61.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b1-768x45.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b1-624x37.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b1.png 1081w\" sizes=\"(max-width: 417px) 100vw, 417px\" \/><\/p>\n<p>Usually, we opt for the date string method because we are using date strings since our childhood.<\/p>\n<p>But here&#8217;s a catch, if we provide a string like 2000-03-16 it&#8217;s totally fine, but writing it as 16-03-2000 in the Date object, returns an Invalid Date.<\/p>\n<p><img decoding=\"async\" class=\"alignnone  wp-image-7543\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b2-300x14.png\" alt=\"\" width=\"407\" height=\"19\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b2-300x14.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b2-1024x47.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b2-768x35.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b2-624x29.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b2.png 1216w\" sizes=\"(max-width: 407px) 100vw, 407px\" \/><\/p>\n<p>let&#8217;s see why-<\/p>\n<p>because there are multiple date formats used all over the world. And dates like 05-07-2011 can be 05 July 2011 or 07 May 2011. It is a bit confusing, right?<\/p>\n<p>In JavaScript, you must choose a universally recognized format when using a date string. One of these formats is the (ISO 8601 Extended format) hyperlink to &#8216;https:\/\/en.wikipedia.org\/wiki\/ISO_8601&#8217;.<\/p>\n<p><img decoding=\"async\" class=\"alignnone  wp-image-7544\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b3-300x26.png\" alt=\"\" width=\"392\" height=\"34\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b3-300x26.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b3-1024x90.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b3-768x68.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b3-624x55.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b3.png 1102w\" sizes=\"(max-width: 392px) 100vw, 392px\" \/><\/p>\n<p><strong>What do these values mean?<\/strong><\/p>\n<ul>\n<li><strong>YYYY<\/strong> \u00a0\u00a0\u00a0\u00a0 -&gt; 4-digit year<\/li>\n<li><strong>MM<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; 2-digit month<\/li>\n<li><strong>DD<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; 2-digit date<\/li>\n<li><strong>&#8211;<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Date delimiters<\/li>\n<li><strong>T<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Indicates &#8211; times start here<\/li>\n<li><strong>HH<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; 24-digit hour<\/li>\n<li><strong>Mm<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Minutes<\/li>\n<li><strong>ss<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Seconds<\/li>\n<li><strong>sss<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Milliseconds<\/li>\n<li><strong>:<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -&gt; Time delimiters<\/li>\n<li>Z: If Z is present, the date will be set to UTC. otherwise, it\u2019ll be Local Time. (Z is only applicable when time is provided.)<\/li>\n<\/ul>\n<p>Time parameters are optional here if you creating a date. So, if you create a date for 11<sup>th<\/sup> June 2019. You can write like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7545\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b4-300x16.png\" alt=\"\" width=\"394\" height=\"21\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b4-300x16.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b4-1024x55.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b4-768x41.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b4-624x33.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b4.png 1083w\" sizes=\"(max-width: 394px) 100vw, 394px\" \/><\/p>\n<p>Wait! Sorry for the interruption, there\u2019s one more catch. If you reside in a region which is behind GMT you will get the date behind GMT:<\/p>\n<p><strong> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7546\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b5-300x26.png\" alt=\"\" width=\"381\" height=\"33\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b5-300x26.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b5-1024x89.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b5-768x67.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b5-624x54.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b5.png 1151w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/strong><\/p>\n<p>If you reside in a region that is ahead of GMT, you will see the date as June 11th.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7547\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b6-300x24.png\" alt=\"\" width=\"388\" height=\"31\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b6-300x24.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b6-1024x81.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b6-768x61.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b6-624x49.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b6.png 1152w\" sizes=\"(max-width: 388px) 100vw, 388px\" \/><\/p>\n<p>So, this happens because without time parameters Date object returns the date according to the UTC standard. If you want the date to be in local standard use time parameters too.<\/p>\n<p><strong> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7548\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b7-300x16.png\" alt=\"\" width=\"375\" height=\"20\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b7-300x16.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b7-1024x56.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b7-768x42.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b7-624x34.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b7.png 1099w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/strong><\/p>\n<p><strong> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7549\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b8-300x52.png\" alt=\"\" width=\"375\" height=\"65\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b8-300x52.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b8-1024x178.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b8-768x133.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b8-624x108.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b8.png 1152w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/strong><\/p>\n<p><strong>Conclusion: <\/strong>The whole matter of local and UTC thing can mess up the code and generate hard-to-catch errors, so the recommendation is not to create a date with the date Strings method.<\/p>\n<p><strong>2.) <\/strong><strong>Passing arguments method<\/strong><strong>: &#8211;<\/strong><\/p>\n<p>In the Date() object you can pass up to 7 arguments. Which are:<\/p>\n<ol>\n<li><strong>Year:<\/strong>\u00a04-digit year.<\/li>\n<li><strong>Month:<\/strong> Month of the year (0-11). The month<em>\u00a0is zero-indexed.<\/em>\u00a0Defaults to 0 if left empty.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7550\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b9-300x25.png\" alt=\"\" width=\"384\" height=\"32\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b9-300x25.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b9-1024x84.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b9-768x63.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b9-624x51.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b9.png 1093w\" sizes=\"(max-width: 384px) 100vw, 384px\" \/><\/p>\n<ol>\n<li><strong>Day:<\/strong>\u00a0Day of the month (1-31). Defaults to 1 if left empty.<\/li>\n<li><strong>Hour:<\/strong>\u00a0Hour of the day (0-23). Defaults to 0 if left empty.<\/li>\n<li><strong>Minutes:<\/strong>\u00a0Minutes (0-59). Defaults to 0 if left empty.<\/li>\n<li><strong>Seconds:<\/strong>\u00a0Seconds (0-59). Defaults to 0 if left empty.<\/li>\n<li><strong>Milliseconds:<\/strong> Milliseconds (0-999). Defaults to 0 if left empty.<\/li>\n<\/ol>\n<p>Many developers avoid this approach, I was also unaware of this approach before writing this blog, but this approach is quite easy and accurate.<\/p>\n<p>Reading it from left to right. Arguments are blessings. (<strong><em>*month argument starts from 0. A.k.a. 0 for January.<\/em><\/strong>)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7551\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b10-300x92.png\" alt=\"\" width=\"372\" height=\"114\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b10-300x92.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b10-1024x314.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b10-768x235.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b10-624x191.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b10.png 1094w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><\/p>\n<p>Example:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7552\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b11-300x19.png\" alt=\"\" width=\"363\" height=\"23\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b11-300x19.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b11-1024x64.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b11-768x48.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b11-624x39.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b11.png 1095w\" sizes=\"(max-width: 363px) 100vw, 363px\" \/><\/p>\n<p>Notice here, the dates created are in Local Time.<\/p>\n<p>In case you want the UTC date format. You need to pass the Date.UTC formatter. Ex.:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7553\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b12-300x25.png\" alt=\"\" width=\"360\" height=\"30\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b12-300x25.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b12-1024x86.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b12-768x65.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b12-624x52.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b12.png 1095w\" sizes=\"(max-width: 360px) 100vw, 360px\" \/><\/p>\n<p><strong>3.) Timestamp method: &#8211;<\/strong><\/p>\n<p><em>In JavaScript, a timestamp is the number of milliseconds elapsed since 1 January 1970. <\/em>It is also called Unix epoch time.<\/p>\n<p>Well, it is very rare to create dates with epoch time, but we can use it to compare dates.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7554\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b13-300x23.png\" alt=\"\" width=\"352\" height=\"27\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b13-300x23.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b13-1024x80.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b13-768x60.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b13-624x49.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b13.png 1102w\" sizes=\"(max-width: 352px) 100vw, 352px\" \/><\/p>\n<p><strong>4.) No arguments method: &#8211;<\/strong><\/p>\n<p>With no arguments passed in the Date object, returns the current date in local Time.<\/p>\n<p><strong> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7555\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b14-300x18.png\" alt=\"\" width=\"350\" height=\"21\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b14-300x18.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b14-1024x61.png 1024w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b14-768x46.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b14-624x37.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b14.png 1093w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-7556\" src=\"https:\/\/innovationm.co\/wp-content\/uploads\/2022\/12\/b15-300x19.png\" alt=\"\" width=\"347\" height=\"22\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b15-300x19.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b15-768x49.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b15-624x40.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/b15.png 826w\" sizes=\"(max-width: 347px) 100vw, 347px\" \/><\/p>\n<p>This is the image above; you can tell the time when I wrote this blog. <\/p>\n<p>I hope you understand about the Date object and will not terrify by this cute object again.<\/p>\n<p>Happy Coding <\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you already know everything in JavaScript is an object. One of the objects is so weird in JavaScript called Date(). Today, even experienced devs get nervous with Date() and reach for libraries like &#8216;date-fns&#8217; and &#8216;moment&#8217;. Yes, you read it at the right moment. which is the most popular library while struggling with date [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7557,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71],"tags":[722,723,224,346],"class_list":["post-7541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobile","tag-blog","tag-blogging","tag-java","tag-javascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Only Date() you need to go on (A JS developer version) - InnovationM - Blog<\/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:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Only Date() you need to go on (A JS developer version) - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"As you already know everything in JavaScript is an object. One of the objects is so weird in JavaScript called Date(). Today, even experienced devs get nervous with Date() and reach for libraries like &#8216;date-fns&#8217; and &#8216;moment&#8217;. Yes, you read it at the right moment. which is the most popular library while struggling with date [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-22T07:16:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1689\" \/>\n\t<meta property=\"og:image:height\" content=\"950\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Only Date() you need to go on (A JS developer version)\",\"datePublished\":\"2022-12-22T07:16:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/\"},\"wordCount\":860,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/only-date-.png\",\"keywords\":[\"blog\",\"blogging\",\"java\",\"JavaScript\"],\"articleSection\":[\"Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/\",\"name\":\"Only Date() you need to go on (A JS developer version) - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/only-date-.png\",\"datePublished\":\"2022-12-22T07:16:46+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/only-date-.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/only-date-.png\",\"width\":1689,\"height\":950},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/only-date-you-need-to-go-on-a-js-developer-version\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Only Date() you need to go on (A JS developer version)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Only Date() you need to go on (A JS developer version) - InnovationM - Blog","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:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/","og_locale":"en_US","og_type":"article","og_title":"Only Date() you need to go on (A JS developer version) - InnovationM - Blog","og_description":"As you already know everything in JavaScript is an object. One of the objects is so weird in JavaScript called Date(). Today, even experienced devs get nervous with Date() and reach for libraries like &#8216;date-fns&#8217; and &#8216;moment&#8217;. Yes, you read it at the right moment. which is the most popular library while struggling with date [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/","og_site_name":"InnovationM - Blog","article_published_time":"2022-12-22T07:16:46+00:00","og_image":[{"width":1689,"height":950,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Only Date() you need to go on (A JS developer version)","datePublished":"2022-12-22T07:16:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/"},"wordCount":860,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png","keywords":["blog","blogging","java","JavaScript"],"articleSection":["Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/","url":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/","name":"Only Date() you need to go on (A JS developer version) - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png","datePublished":"2022-12-22T07:16:46+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/12\/only-date-.png","width":1689,"height":950},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/only-date-you-need-to-go-on-a-js-developer-version\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Only Date() you need to go on (A JS developer version)"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=7541"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7541\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/7557"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=7541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=7541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=7541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}