toDateString() produces something like “Mon Aug 09 2023”, so we can compare the two strings to see if they are the same day.
This doesn’t check if the dates are the same, only that it is the same day, month & year
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"adro.codes","colors":{"primary":"#f59e0b","light":"#d97706","dark":"#f59e0b"},"favicon":"/favicon.svg","logo":{"light":"https://mintcdn.com/adrocodes/4BK3kYLBrRFwX4OU/logo/light.svg?fit=max\u0026auto=format\u0026n=4BK3kYLBrRFwX4OU\u0026q=85\u0026s=3e7006b0daf93ea6749653421337e270","dark":"https://mintcdn.com/adrocodes/4BK3kYLBrRFwX4OU/logo/dark.svg?fit=max\u0026auto=format\u0026n=4BK3kYLBrRFwX4OU\u0026q=85\u0026s=58c210ae98d1bde91fca23cf733851f2"},"footer":{"socials":{"github":"https://github.com/adrocodes"}},"integrations":{"ga4":{"measurementId":"G-9CF5MG7673"}},"navigation":{"global":{"anchors":[{"anchor":"Papers","href":"https://papers.adro.codes","icon":{"name":"scroll","style":"duotone"}},{"anchor":"Github","href":"https://github.com/adrocodes","icon":{"name":"github","style":"duotone"}}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"adrocodes","hasAudioNarration":false,"actualSubdomain":"adrocodes","customDomains":["adro.codes"],"gitSource":{"type":"github","owner":"adrocodes","repo":"mintlify-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae91dc15d9fe27156017997:success","clientVersion":"0.0.4094","searchFilterCounts":[{"language":"default","tag":"Home","count":21},{"language":"default","tag":"Tiny tips/tricks","count":20},{"language":"default","tag":"The Knowledge Vault","count":14},{"language":"default","tag":"The Vault","count":14},{"language":"default","tag":"Pigeon","count":12},{"language":"default","tag":"Software Design","count":6},{"language":"default","tag":"C#","count":5},{"language":"default","tag":"JavaScript","count":5},{"language":"default","tag":"Azure","count":2},{"language":"default","tag":"Godot","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"how-to/javascript/check-if-two-dates-are-the-same-day","slug":"/how-to/javascript/check-if-two-dates-are-the-same-day","pageMetadata":{"title":"Check if two dates are the same day","description":"Need to compare two dates and check if it is the same day? Here is how you can do it.","href":"/how-to/javascript/check-if-two-dates-are-the-same-day"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Need to compare two dates and check if it is the same day? Here is how you can do it.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Info}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Info)_missingMdxReference(`Info`,true);return _jsxs(_Fragment,{children:[_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` datesAreTheSameDay`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`date1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`date2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` date1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toDateString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`===`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` date2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toDateString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`toDateString()`}),` produces something like “Mon Aug 09 2023”, so we can compare the two strings to see if they are the same day.`]}),`\n`,_jsx(Info,{children:`This doesn’t check if the dates are the same, only that it is the same day, month \u0026 year`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Check if two dates are the same day","description":"Need to compare two dates and check if it is the same day? Here is how you can do it.","href":"/how-to/javascript/check-if-two-dates-are-the-same-day"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"adrocodes","siteName":"adro.codes","title":"Check if two dates are the same day - adro.codes","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-06T23:51:31.588Z","originalFileLocation":"how-to/javascript/check-if-two-dates-are-the-same-day.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Need to compare two dates and check if it is the same day? Here is how you can do it.\">\u003cmeta data-mint-head name=\"application-name\" content=\"adro.codes\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Check if two dates are the same day - adro.codes\">\u003cmeta data-mint-head property=\"og:description\" content=\"Need to compare two dates and check if it is the same day? Here is how you can do it.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"adro.codes\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://adrocodes.mintlify.site/_mintlify/api/og/v2?division=JavaScript\u0026amp;title=Check+if+two+dates+are+the+same+day\u0026amp;description=Need+to+compare+two+dates+and+check+if+it+is+the+same+day%3F+Here+is+how+you+can+do+it.\u0026amp;theme=5a98e02ff7d6a3cbb90dbd12\u0026amp;signature=06af550ac1e8305caa57f9fd1e64db0af7e4989ad4c080fa728680268c483241\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Check if two dates are the same day - adro.codes\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Need to compare two dates and check if it is the same day? Here is how you can do it.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://adrocodes.mintlify.site/_mintlify/api/og/v2?division=JavaScript\u0026amp;title=Check+if+two+dates+are+the+same+day\u0026amp;description=Need+to+compare+two+dates+and+check+if+it+is+the+same+day%3F+Here+is+how+you+can+do+it.\u0026amp;theme=5a98e02ff7d6a3cbb90dbd12\u0026amp;signature=06af550ac1e8305caa57f9fd1e64db0af7e4989ad4c080fa728680268c483241\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/adrocodes/KAEc8dn9Bt9KuuEF/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"adro.codes\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#f59e0b\">\u003clink data-mint-head rel=\"canonical\" href=\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/how-to/javascript/check-if-two-dates-are-the-same-day.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://adro.codes/#organization\",\"name\":\"adro.codes\",\"url\":\"https://adro.codes\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/adrocodes/4BK3kYLBrRFwX4OU/logo/light.svg?fit=max\u0026auto=format\u0026n=4BK3kYLBrRFwX4OU\u0026q=85\u0026s=3e7006b0daf93ea6749653421337e270\"}},{\"@type\":\"WebSite\",\"@id\":\"https://adro.codes#website\",\"name\":\"adro.codes\",\"url\":\"https://adro.codes\",\"publisher\":{\"@id\":\"https://adro.codes/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day#webpage\",\"url\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day\",\"name\":\"Check if two dates are the same day\",\"description\":\"Need to compare two dates and check if it is the same day? Here is how you can do it.\",\"dateModified\":\"2026-01-06T23:51:31.588Z\",\"isPartOf\":{\"@id\":\"https://adro.codes#website\"},\"breadcrumb\":{\"@id\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tiny tips/tricks\",\"item\":\"https://adro.codes/how-to/javascript/check-if-date-is-invalid\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https://adro.codes/how-to/javascript/check-if-date-is-invalid\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Check if two dates are the same day\",\"item\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day#article\",\"headline\":\"Check if two dates are the same day\",\"name\":\"Check if two dates are the same day\",\"description\":\"Need to compare two dates and check if it is the same day? Here is how you can do it.\",\"url\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day\",\"mainEntityOfPage\":{\"@id\":\"https://adro.codes/how-to/javascript/check-if-two-dates-are-the-same-day#webpage\"},\"dateModified\":\"2026-01-06T23:51:31.588Z\",\"publisher\":{\"@id\":\"https://adro.codes/#organization\"},\"isPartOf\":{\"@id\":\"https://adro.codes#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"adro.codes\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"adro.codes","nav":{"global":{"anchors":[{"anchor":"Papers","href":"https://papers.adro.codes","icon":{"name":"scroll","style":"duotone"}},{"anchor":"Github","href":"https://github.com/adrocodes","icon":{"name":"github","style":"duotone"}}]},"tabs":[{"tab":"Home","groups":[{"group":"adro.codes","pages":[{"title":"Welcome","href":"/welcome"}]},{"group":"Tiny tips/tricks","pages":[{"group":"JavaScript","icon":"code","pages":[{"title":"Check if date is invalid","description":"Need to know if a date is invalid? Here's how.","href":"/how-to/javascript/check-if-date-is-invalid"},{"title":"Check if two dates are the same day","href":"/how-to/javascript/check-if-two-dates-are-the-same-day"},{"title":"Get minutes elapsed since midnight","description":"Need to get the minutes elapsed since midnight? Here's how to do it in JavaScript.","href":"/how-to/javascript/get-minutes-elapsed-since-midnight"},{"title":"Import JSON into your Typescript project","href":"/how-to/javascript/import-json-into-typescript-file"},{"title":"How to - Merge to SearchURLParams objects","href":"/how-to/javascript/merge-search-url-params"}]},{"group":"NextJS","icon":"triangle","pages":[{"title":"Respond with PDF from API route","href":"/how-to/next/respond-with-pdf-from-api-route"}]},{"group":"React","icon":"react","pages":[{"title":"Configure Context with a useReducer state management pattern.","href":"/how-to/react/context-with-use-reducer"}]},{"group":"C#","icon":"hashtag","pages":[{"title":"C# - Class Extension","href":"/how-to/csharp/class-extensions"},{"title":"Condition based type casting","href":"/how-to/csharp/condition-based-type-casting"},{"title":"Generics Refresher","href":"/how-to/csharp/generics-refresher"},{"title":"new gotcha","href":"/how-to/csharp/new-gotcha"},{"title":"TryParse","href":"/how-to/csharp/tryparse"}]},{"group":"Azure","icon":"cloud","pages":[{"title":"Generate a SAS token","href":"/how-to/azure/generate-a-sas-token"},{"title":"VSCode - Can't log into Tenant","href":"/how-to/azure/vscode-cant-log-into-tenant"}]},{"group":"SQL","icon":"database","pages":[{"title":"Get overfiew of table","href":"/how-to/sql/get-overview-of-table"}]},{"group":"Git","icon":"code-branch","pages":[{"title":"Add a tag to a branch","href":"/how-to/git/add-tag-to-branch"}]},{"group":"DatoCMS","icon":"folder-grid","pages":[{"title":"Search indexing - Failed to index","href":"/how-to/datocms/search-index-failed-to-index"}]},{"group":"ContentStack","icon":"folder-grid","pages":[{"title":"Optimising GraphQL queries","href":"/how-to/contentstack/optimising-graphql-queries"}]},{"group":"MacOS","icon":"apple","pages":[{"title":"Macbook - Show symbol explorer","href":"/how-to/macos/show-symbol-explorer"}]},{"group":"Godot","icon":"game-console-handheld","pages":[{"title":"Show custom editor warnings on Nodes","href":"/game-development/godot/godot-show-custom-editor-warnings"}]}]}]},{"tab":"The Knowledge Vault","pages":[{"title":"The Knowledge Vault","href":"/vault"}]},{"tab":"Software Design","pages":[{"title":"Software Design","href":"/software-design"}]},{"tab":"Pigeon","pages":[{"title":"Pigeon","href":"/pigeon"}]}]},"basePath":"","title":"Check if two dates are the same day - adro.codes","buildId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","deploymentId":"dpl_42LwxxU1kGN114H4XzwGYXa9ZDah","dynamics":[],"chunks":[]}