{"id":276,"date":"2026-10-31T13:07:22","date_gmt":"2026-10-31T13:07:22","guid":{"rendered":"https:\/\/devdojo.co.in\/?p=276"},"modified":"2026-10-31T13:07:22","modified_gmt":"2026-10-31T13:07:22","slug":"javascript-temporal-api-tutorial","status":"publish","type":"post","link":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/","title":{"rendered":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right"},"content":{"rendered":"\n<div class=\"dd-post\">\n<style>\n.single article:has(.dd-hero) .entry-media{display:none}\n.dd-post{--navy:#0b1020;--blue:#3178c6;--violet:#7c5cff;--ink:#1f2433;--muted:#5b6275;--line:#e3e6ef;font-size:17px;line-height:1.75;color:var(--ink)}\n.dd-post h2{margin:2.2em 0 .6em;font-size:1.6em;line-height:1.3;scroll-margin-top:90px}\n.dd-post h3{margin:1.6em 0 .5em;font-size:1.22em;scroll-margin-top:90px}\n.dd-post a{color:var(--blue);text-decoration:underline;text-underline-offset:3px}\n.dd-post pre{background:#0f1430;color:#e6e9f5;padding:18px 20px;border-radius:12px;overflow-x:auto;line-height:1.6;border:1px solid #232a52;margin:1.2em 0;font-size:14.5px !important}\n.dd-post pre code{font-size:1em !important;background:none;color:inherit;padding:0;font-family:\"JetBrains Mono\",\"Fira Code\",Consolas,Menlo,monospace;white-space:pre}\n.dd-post :not(pre)>code{background:#eef1fb;color:#2b3a8f;padding:2px 6px;border-radius:5px;font-size:.9em}\n.dd-post .dd-file{display:inline-block;background:#151b3b;color:#c9d1ff;font:600 13px\/1 \"JetBrains Mono\",Consolas,monospace;padding:7px 12px;border-radius:8px 8px 0 0;margin:1em 0 -1.2em;position:relative}\n.dd-post .dd-hero{margin:0 0 1.6em;border-radius:16px;overflow:hidden;box-shadow:0 10px 30px rgba(11,16,32,.25)}\n.dd-post .dd-hero svg{display:block;width:100%;height:auto}\n.dd-post .dd-hero .node{transition:transform .25s,filter .25s;transform-box:fill-box;transform-origin:center;cursor:pointer}\n.dd-post .dd-hero .node:hover{transform:scale(1.08);filter:drop-shadow(0 0 10px #7c5cff)}\n.dd-post .dd-series{display:inline-flex;align-items:center;gap:8px;background:#151b3b;color:#dfe3ff;border-radius:999px;padding:6px 14px;font-size:.88em;font-weight:600;margin:0 0 .8em}\n.dd-post .dd-series span{background:var(--violet);color:#fff;border-radius:999px;padding:2px 10px}\n.dd-post .dd-prereq{font-size:.96em;color:var(--muted);border-left:3px solid var(--line);padding-left:12px;margin:.6em 0 1.2em}\n.dd-post .dd-summary{background:linear-gradient(135deg,#eef3ff,#f4efff);border:1px solid #d6dcf5;border-left:5px solid var(--violet);border-radius:12px;padding:18px 22px;margin:1.4em 0}\n.dd-post .dd-summary strong.lbl{display:block;font-size:1.05em;margin-bottom:6px;color:#3a2fa0}\n.dd-post .dd-summary ul{margin:.3em 0 0 1.1em}\n.dd-post .dd-toc{background:#f8f9fc;border:1px solid var(--line);border-radius:12px;padding:16px 22px;margin:1.4em 0}\n.dd-post .dd-toc ol{margin:.4em 0 0 1.2em;columns:2;column-gap:28px}\n.dd-post .dd-toc li{break-inside:avoid;margin:.15em 0}\n@media(max-width:640px){.dd-post .dd-toc ol{columns:1}}\n.dd-post .dd-tip,.dd-post .dd-note,.dd-post .dd-warn{border-radius:10px;padding:14px 18px;margin:1.3em 0}\n.dd-post .dd-tip{background:#ecfbf3;border-left:4px solid #1f9d61}\n.dd-post .dd-note{background:#eef4ff;border-left:4px solid var(--blue)}\n.dd-post .dd-warn{background:#fff6e8;border-left:4px solid #e08a00}\n.dd-post .dd-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;margin:1.3em 0}\n.dd-post .dd-card{border:1px solid var(--line);border-radius:12px;padding:14px 16px;background:#fff;box-shadow:0 2px 8px rgba(20,30,70,.05)}\n.dd-post .dd-card b{display:block;color:#3a2fa0;margin-bottom:4px}\n.dd-post table{width:100%;border-collapse:collapse;margin:1.3em 0;font-size:.95em}\n.dd-post th,.dd-post td{border:1px solid var(--line);padding:10px 12px;text-align:left;vertical-align:top}\n.dd-post th{background:#151b3b;color:#fff}\n.dd-post tr:nth-child(even) td{background:#f8f9fc}\n.dd-post .dd-tablewrap{overflow-x:auto}\n.dd-post figure{margin:1.6em 0;text-align:center}\n.dd-post figure svg{width:100%;height:auto;border-radius:12px}\n.dd-post figcaption{font-size:.9em;color:var(--muted);margin-top:8px}\n.dd-post details{border:1px solid var(--line);border-radius:10px;padding:12px 16px;margin:.7em 0;background:#fff}\n.dd-post details summary{cursor:pointer;font-weight:600}\n.dd-post details[open] summary{margin-bottom:8px;color:#3a2fa0}\n.dd-post .dd-roadmap{border:2px solid #d6dcf5;background:#fbfbff}\n.dd-post .dd-roadmap h4{margin:1em 0 .3em;color:#151b3b;font-size:1em;text-transform:uppercase;letter-spacing:.04em}\n.dd-post .dd-roadmap ol{margin:.2em 0 .6em 1.4em;padding:0}\n.dd-post .dd-roadmap li{margin:.2em 0}\n.dd-post .dd-roadmap .here{background:var(--violet);color:#fff;border-radius:999px;padding:1px 9px;font-size:.8em;font-weight:700;margin-left:6px}\n.dd-post .dd-roadmap .soon{color:#8a90a6;font-size:.82em;margin-left:6px}\n.dd-post .dd-tabs{border:1px solid var(--line);border-radius:12px;padding:6px 16px 16px;margin:1.4em 0;background:#fbfbfe}\n.dd-post .dd-tabs>input{position:absolute;opacity:0;pointer-events:none}\n.dd-post .dd-tabs .labels label{display:inline-block;padding:8px 16px;margin:10px 6px 0 0;border-radius:999px;border:1px solid #cfd5ea;cursor:pointer;font-weight:600;font-size:.95em;background:#fff;transition:background .2s}\n.dd-post .dd-tabs .labels label:hover{border-color:var(--violet)}\n.dd-post .dd-tabs .panel{display:none;margin-top:12px}\n.dd-post .dd-tabs #ti1:checked~.labels label[for=ti1],.dd-post .dd-tabs #ti2:checked~.labels label[for=ti2],.dd-post .dd-tabs #ti3:checked~.labels label[for=ti3],.dd-post .dd-tabs #ti4:checked~.labels label[for=ti4]{background:var(--violet);color:#fff;border-color:var(--violet)}\n.dd-post .dd-tabs #ti1:checked~.p1,.dd-post .dd-tabs #ti2:checked~.p2,.dd-post .dd-tabs #ti3:checked~.p3,.dd-post .dd-tabs #ti4:checked~.p4{display:block}\n.dd-post .dd-tabs #ti1:focus-visible~.labels label[for=ti1],.dd-post .dd-tabs #ti2:focus-visible~.labels label[for=ti2],.dd-post .dd-tabs #ti3:focus-visible~.labels label[for=ti3],.dd-post .dd-tabs #ti4:focus-visible~.labels label[for=ti4]{outline:2px solid var(--blue);outline-offset:2px}\n.dd-post .dd-cta{background:linear-gradient(135deg,#0b1020,#151b3b);color:#e8ebff;border-radius:16px;padding:24px 26px;margin:2em 0;text-align:center}\n.dd-post .dd-cta h3{color:#fff;margin-top:0}\n.dd-post .dd-cta a{color:#a99bff}\n.dd-post .dd-vsc{position:relative;margin:1.5em 0;border-radius:12px;overflow:hidden;background:#1e1e1e;border:1px solid #2b2b2b;box-shadow:0 14px 34px rgba(0,0,0,.28);font-family:\"Segoe UI\",system-ui,sans-serif}\n.dd-post .dd-vsc>input{position:absolute;opacity:0;pointer-events:none}\n.dd-post .dd-vsc-bar{display:flex;align-items:center;gap:12px;background:#323233;color:#cccccc;font-size:12.5px;padding:8px 12px}\n.dd-post .dd-dots{display:inline-flex;gap:7px}.dd-post .dd-dots i{width:12px;height:12px;border-radius:50%;background:#ff5f57;display:block}.dd-post .dd-dots i:nth-child(2){background:#febc2e}.dd-post .dd-dots i:nth-child(3){background:#28c840}\n.dd-post .dd-vsc-title{flex:1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:50px;opacity:.85}\n.dd-post .dd-vsc-tabs{display:flex;align-items:stretch;background:#252526;border-bottom:1px solid #1e1e1e;overflow-x:auto}\n.dd-post .dd-vsc-tabs label{display:flex;align-items:center;gap:7px;padding:9px 16px;color:#969696;font-size:13px;cursor:pointer;background:#2d2d2d;border-right:1px solid #252526;border-top:1px solid transparent;white-space:nowrap;margin:0;transition:color .15s}\n.dd-post .dd-vsc-tabs label:hover{color:#e0e0e0}\n.dd-post .dd-vsc-tabs .ic{font:700 9.5px\/1 Consolas,monospace;padding:3px 4px;border-radius:3px;color:#1e1e1e}\n.dd-post .ic.py{background:#ffd43b}.dd-post .ic.js{background:#f1e05a}.dd-post .ic.sh{background:#89e051}\n.dd-post .dd-vsc-tabs label.run{margin-left:auto;background:transparent;border:0;color:#89d185;font-weight:600;display:none}\n.dd-post .dd-vsc-tabs label.run:hover{color:#b5f0b0;background:#2a2d2e}\n.dd-post .dd-vsc-pane{display:none}\n.dd-post .dd-vsc>.f1:checked~.dd-vsc-tabs .t1,.dd-post .dd-vsc>.f2:checked~.dd-vsc-tabs .t2,.dd-post .dd-vsc>.f3:checked~.dd-vsc-tabs .t3{background:#1e1e1e;color:#ffffff;border-top-color:#3178c6}\n.dd-post .dd-vsc>.f1:checked~.p1,.dd-post .dd-vsc>.f2:checked~.p2,.dd-post .dd-vsc>.f3:checked~.p3{display:block}\n.dd-post .dd-vsc>.f1:checked~.dd-vsc-tabs .run1,.dd-post .dd-vsc>.f2:checked~.dd-vsc-tabs .run2,.dd-post .dd-vsc>.f3:checked~.dd-vsc-tabs .run3{display:flex}\n.dd-post .dd-vsc>.f1:focus-visible~.dd-vsc-tabs .t1,.dd-post .dd-vsc>.f2:focus-visible~.dd-vsc-tabs .t2,.dd-post .dd-vsc>.f3:focus-visible~.dd-vsc-tabs .t3,.dd-post .dd-vsc>input[type=checkbox]:focus-visible~.dd-vsc-tabs .run{outline:2px solid #3178c6;outline-offset:-2px}\n.dd-post .dd-vsc-crumbs{background:#1e1e1e;color:#a9a9a9;font-size:12px;padding:5px 16px 2px}\n.dd-post .dd-vsc pre.dd-vsc-code{background:#1e1e1e;color:#d4d4d4;border:0;border-radius:0;margin:0;padding:8px 0 14px;counter-reset:ln;line-height:1.62;overflow-x:auto}\n.dd-post .dd-vsc pre code{font-family:Consolas,\"JetBrains Mono\",\"Fira Code\",Menlo,monospace;color:inherit;background:none;white-space:pre}\n.dd-post .dd-vsc .l{display:inline-block;min-width:100%;padding-right:18px;box-sizing:border-box}\n.dd-post .dd-vsc .l::before{counter-increment:ln;content:counter(ln);display:inline-block;width:3.2em;padding-right:1.4em;text-align:right;color:#6e7681;user-select:none;-webkit-user-select:none}\n.dd-post .dd-vsc .l:hover{background:#2a2d2e}.dd-post .dd-vsc .l:hover::before{color:#c6c6c6}\n.dd-post .dd-vsc .k,.dd-post .dd-vsc .kn{color:#c586c0}.dd-post .dd-vsc .kc{color:#569cd6}.dd-post .dd-vsc .s{color:#ce9178}.dd-post .dd-vsc .c{color:#6a9955}.dd-post .dd-vsc .m{color:#b5cea8}.dd-post .dd-vsc .nf{color:#dcdcaa}.dd-post .dd-vsc .nc{color:#4ec9b0}.dd-post .dd-vsc .nb{color:#4ec9b0}.dd-post .dd-vsc .nd{color:#dcdcaa}.dd-post .dd-vsc .n{color:#9cdcfe}.dd-post .dd-vsc .o{color:#d4d4d4}.dd-post .dd-vsc .gp{color:#89d185;user-select:none;-webkit-user-select:none}\n.dd-post .dd-vsc-term{display:none;border-top:1px solid #3c3c3c;background:#181818}\n.dd-post .dd-vsc>.r1:checked~.p1 .dd-vsc-term,.dd-post .dd-vsc>.r2:checked~.p2 .dd-vsc-term,.dd-post .dd-vsc>.r3:checked~.p3 .dd-vsc-term{display:block;animation:ddterm .35s ease-out}\n@keyframes ddterm{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}\n.dd-post .dd-term-head{display:flex;gap:18px;align-items:center;font-size:11px;letter-spacing:.06em;color:#8b8b8b;padding:7px 16px 0}\n.dd-post .dd-term-head span:first-child{color:#e7e7e7;border-bottom:1px solid #e7e7e7;padding-bottom:4px}\n.dd-post .dd-term-head .dd-term-note{margin-left:auto;letter-spacing:0;text-transform:none;color:#d7ba7d;border:0;font-size:11.5px}\n.dd-post .dd-vsc-term pre{background:#181818;color:#cccccc;border:0;margin:0;padding:10px 16px 14px;border-radius:0}\n.dd-post .dd-vsc-status{display:flex;flex-wrap:wrap;gap:4px 14px;background:#007acc;color:#fff;font-size:11.5px;padding:4px 12px}\n.dd-post .dd-vsc-status .sp{flex:1}\n.dd-post .dd-vsc-termonly pre.dd-vsc-code{background:#181818;padding:12px 16px}\n@media(max-width:640px){.dd-post .dd-vsc-title{padding-right:0;text-align:left}.dd-post .dd-vsc-status span:nth-child(n+4){display:none}.dd-post .dd-vsc .l::before{width:2.2em;padding-right:1em}}\n.dd-post .dd-vsc-hint{font-size:.93em;color:var(--muted);margin-top:-.6em}\n.dd-post .dd-next{border:1px dashed var(--violet);border-radius:12px;padding:16px 20px;margin:1.6em 0;background:#f7f4ff}\n.dd-post .ic.yml{background:#cb3837;color:#fff}\n.dd-post .ic.jsx{background:#61dafb}.dd-post .ic.html{background:#e44d26;color:#fff}.dd-post .ic.css{background:#563d7c;color:#fff}\n.dd-post .dd-steps{counter-reset:st;list-style:none;margin:1.2em 0;padding:0}\n.dd-post .dd-steps>li{position:relative;padding:0 0 0 46px;margin:0 0 14px}\n.dd-post .dd-steps>li::before{counter-increment:st;content:counter(st);position:absolute;left:0;top:2px;width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#3178c6,#7c5cff);color:#fff;font-weight:700;text-align:center;line-height:32px}\n<\/style>\n<div class=\"dd-hero\">\n<svg viewBox=\"0 0 1200 520\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" role=\"img\" aria-label=\"JavaScript Temporal API banner: one exact moment shown as local times in India, London, New York and Tokyo\">\n<defs>\n<linearGradient id=\"tpbg\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"#0b1020\"\/><stop offset=\"1\" stop-color=\"#151b3b\"\/><\/linearGradient>\n<linearGradient id=\"tpac\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\"><stop offset=\"0\" stop-color=\"#3178c6\"\/><stop offset=\"1\" stop-color=\"#7c5cff\"\/><\/linearGradient>\n<radialGradient id=\"tpglow\" cx=\".5\" cy=\".5\" r=\".5\"><stop offset=\"0\" stop-color=\"#7c5cff\" stop-opacity=\".45\"\/><stop offset=\"1\" stop-color=\"#7c5cff\" stop-opacity=\"0\"\/><\/radialGradient>\n<\/defs>\n<rect x=\"0\" y=\"-60\" width=\"1200\" height=\"640\" fill=\"url(#tpbg)\"\/>\n<circle cx=\"900\" cy=\"320\" r=\"280\" fill=\"url(#tpglow)\"\/>\n<g opacity=\".12\" stroke=\"#9fb2ff\"><path d=\"M0 100H1200M0 200H1200M0 300H1200M0 400H1200M200 0V520M400 0V520M600 0V520M800 0V520M1000 0V520\"\/><\/g>\n<rect x=\"60\" y=\"46\" width=\"168\" height=\"38\" rx=\"19\" fill=\"url(#tpac)\"\/>\n<text x=\"144\" y=\"71\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"18\" font-weight=\"700\" fill=\"#fff\">Built-in \u00b7 No library<\/text>\n<text x=\"244\" y=\"71\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"18\" fill=\"#aab4e8\">JavaScript \u00b7 DevDojo<\/text>\n<text x=\"60\" y=\"148\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"54\" font-weight=\"800\" fill=\"#ffffff\">JavaScript Temporal API<\/text>\n<text x=\"60\" y=\"208\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"38\" font-weight=\"800\" fill=\"#c9d1ff\">Dates and time zones, done right<\/text>\n<text x=\"60\" y=\"252\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"23\" fill=\"#aab4e8\">Plain dates \u00b7 Time zones \u00b7 Daylight saving \u00b7 Durations<\/text>\n<g font-family=\"Consolas,monospace\" font-size=\"19\">\n<rect x=\"60\" y=\"300\" width=\"470\" height=\"150\" rx=\"14\" fill=\"#1e1e1e\" stroke=\"#2b2b2b\"\/>\n<circle cx=\"84\" cy=\"322\" r=\"6\" fill=\"#ff5f57\"\/><circle cx=\"104\" cy=\"322\" r=\"6\" fill=\"#febc2e\"\/><circle cx=\"124\" cy=\"322\" r=\"6\" fill=\"#28c840\"\/>\n<text x=\"84\" y=\"362\" fill=\"#569cd6\">const <tspan fill=\"#9cdcfe\">talk<\/tspan><tspan fill=\"#d4d4d4\"> = <\/tspan><tspan fill=\"#4ec9b0\">Temporal<\/tspan><tspan fill=\"#d4d4d4\">.<\/tspan><tspan fill=\"#4ec9b0\">ZonedDateTime<\/tspan><\/text>\n<text x=\"104\" y=\"392\" fill=\"#d4d4d4\">.<tspan fill=\"#dcdcaa\">from<\/tspan>(<tspan fill=\"#ce9178\">&#8216;\u2026T19:00[Asia\/Kolkata]&#8217;<\/tspan>);<\/text>\n<text x=\"84\" y=\"426\" fill=\"#9cdcfe\">talk<tspan fill=\"#d4d4d4\">.<\/tspan><tspan fill=\"#dcdcaa\">withTimeZone<\/tspan><tspan fill=\"#d4d4d4\">(<\/tspan><tspan fill=\"#ce9178\">&#8216;Asia\/Tokyo&#8217;<\/tspan><tspan fill=\"#d4d4d4\">);<\/tspan><\/text>\n<\/g>\n<path id=\"tpp1\" d=\"M700 360 C 760 300, 800 230, 875 200\" fill=\"none\" stroke=\"#3178c6\" stroke-width=\"2\" stroke-dasharray=\"6 6\" opacity=\".7\"\/>\n<path id=\"tpp2\" d=\"M700 360 C 800 360, 920 340, 1055 330\" fill=\"none\" stroke=\"#7c5cff\" stroke-width=\"2\" stroke-dasharray=\"6 6\" opacity=\".7\"\/>\n<path id=\"tpp3\" d=\"M700 360 C 760 420, 820 450, 895 450\" fill=\"none\" stroke=\"#61dafb\" stroke-width=\"2\" stroke-dasharray=\"6 6\" opacity=\".7\"\/>\n<path id=\"tpp4\" d=\"M700 360 C 820 300, 960 200, 1055 150\" fill=\"none\" stroke=\"#89e051\" stroke-width=\"2\" stroke-dasharray=\"6 6\" opacity=\".7\"\/>\n<circle r=\"6\" fill=\"#3178c6\"><animateMotion dur=\"2.6s\" repeatCount=\"indefinite\"><mpath href=\"#tpp1\"\/><\/animateMotion><\/circle>\n<circle r=\"6\" fill=\"#7c5cff\"><animateMotion dur=\"3.1s\" repeatCount=\"indefinite\"><mpath href=\"#tpp2\"\/><\/animateMotion><\/circle>\n<circle r=\"6\" fill=\"#61dafb\"><animateMotion dur=\"2.8s\" repeatCount=\"indefinite\"><mpath href=\"#tpp3\"\/><\/animateMotion><\/circle>\n<circle r=\"6\" fill=\"#89e051\"><animateMotion dur=\"3.4s\" repeatCount=\"indefinite\"><mpath href=\"#tpp4\"\/><\/animateMotion><\/circle>\n<g class=\"node\"><circle cx=\"700\" cy=\"360\" r=\"56\" fill=\"#0b1020\" stroke=\"url(#tpac)\" stroke-width=\"4\"\/><text x=\"700\" y=\"355\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"17\" font-weight=\"800\" fill=\"#fff\">ONE<\/text><text x=\"700\" y=\"377\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#c9d1ff\">instant<\/text><\/g>\n<g class=\"node\"><rect x=\"800\" y=\"170\" width=\"150\" height=\"60\" rx=\"12\" fill=\"#0b1020\" stroke=\"#3178c6\" stroke-width=\"2\"\/><text x=\"875\" y=\"196\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">London<\/text><text x=\"875\" y=\"219\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#fff\">13:30<\/text><\/g>\n<g class=\"node\"><rect x=\"980\" y=\"300\" width=\"150\" height=\"60\" rx=\"12\" fill=\"#0b1020\" stroke=\"#7c5cff\" stroke-width=\"2\"\/><text x=\"1055\" y=\"326\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">Tokyo<\/text><text x=\"1055\" y=\"349\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#fff\">22:30<\/text><\/g>\n<g class=\"node\"><rect x=\"820\" y=\"420\" width=\"150\" height=\"60\" rx=\"12\" fill=\"#0b1020\" stroke=\"#61dafb\" stroke-width=\"2\"\/><text x=\"895\" y=\"446\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">New York<\/text><text x=\"895\" y=\"469\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#fff\">08:30<\/text><\/g>\n<g class=\"node\"><rect x=\"980\" y=\"120\" width=\"150\" height=\"60\" rx=\"12\" fill=\"#0b1020\" stroke=\"#89e051\" stroke-width=\"2\"\/><text x=\"1055\" y=\"146\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">India (IST)<\/text><text x=\"1055\" y=\"169\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#fff\">19:00<\/text><\/g>\n<\/svg>\n<\/div>\n<p>If you have ever seen a birthday show up one day early, a meeting reminder fire an hour late after daylight saving, or <code>new Date(2026, 1, 1)<\/code> give you March instead of February, you already know dates in JavaScript are painful. The <strong>JavaScript Temporal API<\/strong> is the new built-in fix. It gives you clear types for dates, times, time zones and durations, its values never change by accident, and it is now enabled by default in Node.js 26 and in recent browsers.<\/p>\n<p>In this beginner-friendly tutorial you will learn what Temporal is, which type to use for which job, how to handle time zones and daylight saving, how to calculate durations, and how to move your existing <code>Date<\/code> code over step by step. Every example was run on Node.js 26 and the real output is shown in the code editors.<\/p>\n<div class=\"dd-summary\"><strong class=\"lbl\">Quick Summary<\/strong><ul>\n<li><b>Temporal<\/b> is a new global object (like <code>Math<\/code>) that replaces most uses of <code>Date<\/code>. No library to install on Node.js 26+.<\/li>\n<li>Use <code>PlainDate<\/code> \/ <code>PlainTime<\/code> \/ <code>PlainDateTime<\/code> for calendar data with no time zone, <code>ZonedDateTime<\/code> for real events in a place, and <code>Instant<\/code> for exact timestamps.<\/li>\n<li>Temporal objects are <b>immutable<\/b>: <code>add()<\/code> and <code>with()<\/code> return new objects, so nothing changes behind your back.<\/li>\n<li>Months start at <b>1<\/b>, time zones and daylight saving are handled for you, and <code>until()<\/code> gives a proper <code>Duration<\/code>.<\/li>\n<li>For older browsers or Node.js 24 and below, add <code>temporal-polyfill<\/code>.<\/li>\n<\/ul><\/div>\n<nav class=\"dd-toc\" aria-label=\"Table of contents\"><strong>Table of contents<\/strong><ol>\n<li><a href=\"#why-date-is-hard\">Why JavaScript dates are hard<\/a><\/li>\n<li><a href=\"#what-is-temporal\">What is the JavaScript Temporal API?<\/a><\/li>\n<li><a href=\"#where-to-use\">Where can you use Temporal today?<\/a><\/li>\n<li><a href=\"#plain-types\">Plain dates and times<\/a><\/li>\n<li><a href=\"#time-zones\">Time zones and daylight saving<\/a><\/li>\n<li><a href=\"#durations\">Durations, differences and formatting<\/a><\/li>\n<li><a href=\"#convert\">Converting between Date and Temporal<\/a><\/li>\n<li><a href=\"#polyfill\">Using the polyfill<\/a><\/li>\n<li><a href=\"#which-type\">Which Temporal type should I use?<\/a><\/li>\n<li><a href=\"#errors\">Common errors and fixes<\/a><\/li>\n<li><a href=\"#best-practices\">Best practices<\/a><\/li>\n<li><a href=\"#faq\">FAQ<\/a><\/li>\n<\/ol><\/nav>\n<\/div>\n\n\n\n<div class=\"dd-post\">\n<h2 id=\"why-date-is-hard\">Why JavaScript dates are hard<\/h2>\n<p>The <code>Date<\/code> object was copied from Java in 1995 in about ten days, and it has carried the same design problems ever since. Three of them cause most real-world bugs:<\/p>\n<div class=\"dd-cards\">\n<div class=\"dd-card\"><b>Months start at 0<\/b>January is <code>0<\/code> and December is <code>11<\/code>, but days start at 1. Easy to get wrong, hard to spot in review.<\/div>\n<div class=\"dd-card\"><b>Values can change<\/b><code>setDate()<\/code> and friends change the original object. If two variables point to it, both change.<\/div>\n<div class=\"dd-card\"><b>Only two time zones<\/b>A <code>Date<\/code> only knows UTC and &#8220;the computer&#8217;s local zone&#8221;. Showing a time in Tokyo needs extra tricks.<\/div>\n<\/div>\n<p>Here is what that looks like in practice, side by side with the Temporal version of the same tasks:<\/p>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: date-problems.mjs, temporal-fix.mjs\">\n<input type=\"radio\" name=\"v1\" id=\"v1f1\" class=\"f1\" checked>\n<input type=\"radio\" name=\"v1\" id=\"v1f2\" class=\"f2\">\n<input type=\"checkbox\" id=\"v1r1\" class=\"r1\">\n<input type=\"checkbox\" id=\"v1r2\" class=\"r2\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">date-problems.mjs \u2014 temporal-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v1f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>date-problems.mjs<\/label>\n<label for=\"v1f2\" class=\"t2\"><b class=\"ic js\">JS<\/b>temporal-fix.mjs<\/label>\n<label for=\"v1r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<label for=\"v1r2\" class=\"run run2\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a date-problems.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ The old Date object: three classic surprises<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">d<\/span> = new <span class=\"nc\">Date<\/span>(<span class=\"m\">2026<\/span>, <span class=\"m\">0<\/span>, <span class=\"m\">31<\/span>);        <span class=\"c\">\/\/ months start at 0, so 0 = January<\/span><\/span>\n<span class=\"l\"><span class=\"n\">d<\/span>.<span class=\"nf\">setMonth<\/span>(<span class=\"n\">d<\/span>.<span class=\"nf\">getMonth<\/span>() + <span class=\"m\">1<\/span>);           <span class=\"c\">\/\/ \"add one month\"...<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">d<\/span>.<span class=\"nf\">toDateString<\/span>());          <span class=\"c\">\/\/ ...lands in March, not February!<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">start<\/span> = new <span class=\"nc\">Date<\/span>(<span class=\"s\">'2026-11-01'<\/span>);<\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">copy<\/span> = <span class=\"n\">start<\/span>;                     <span class=\"c\">\/\/ not a copy - same object<\/span><\/span>\n<span class=\"l\"><span class=\"n\">copy<\/span>.<span class=\"nf\">setDate<\/span>(<span class=\"m\">15<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">start<\/span>.<span class=\"nf\">getDate<\/span>());           <span class=\"c\">\/\/ start changed too: 15<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Date-only strings are read as UTC midnight, so the day can shift<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">nov1<\/span> = new <span class=\"nc\">Date<\/span>(<span class=\"s\">'2026-11-01'<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">nov1<\/span>.<span class=\"nf\">toLocaleDateString<\/span>(<span class=\"s\">'en-US'<\/span>, { <span class=\"n\">timeZone<\/span>: <span class=\"s\">'America\/New_York'<\/span> }));<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, TZ=Asia\/Kolkata)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node date-problems.mjs\nTue Mar 03 2026\n15\n10\/31\/2026<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 13, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<div class=\"dd-vsc-pane p2\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a temporal-fix.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ The same tasks with Temporal<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">jan31<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-01-31'<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">jan31<\/span>.<span class=\"nf\">add<\/span>({ <span class=\"n\">months<\/span>: <span class=\"m\">1<\/span> }).<span class=\"nf\">toString<\/span>()); <span class=\"c\">\/\/ clamps to end of Feb<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">start<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-11-01'<\/span>);<\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">later<\/span> = <span class=\"n\">start<\/span>.<span class=\"nf\">with<\/span>({ <span class=\"n\">day<\/span>: <span class=\"m\">15<\/span> });           <span class=\"c\">\/\/ returns a NEW object<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">start<\/span>.<span class=\"nf\">toString<\/span>(), <span class=\"n\">later<\/span>.<span class=\"nf\">toString<\/span>()); <span class=\"c\">\/\/ start is unchanged<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">start<\/span>.<span class=\"n\">month<\/span>, <span class=\"n\">start<\/span>.<span class=\"n\">dayOfWeek<\/span>, <span class=\"n\">start<\/span>.<span class=\"n\">daysInMonth<\/span>);<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, Linux)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node temporal-fix.mjs\n2026-02-28\n2026-11-01 2026-11-15\n11 7 30<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 9, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<p class=\"dd-vsc-hint\">Click the two tabs to compare the old <code>Date<\/code> with Temporal, and press <b>\u25b6 Run<\/b> to see the real output.<\/p>\n<p>Look at the first line of each output. &#8220;Add one month&#8221; to 31 January with <code>Date<\/code> silently rolls over into March. Temporal gives you 28 February, the last valid day of the month. The second line shows that changing <code>copy<\/code> also changed <code>start<\/code> with <code>Date<\/code>, while Temporal&#8217;s <code>with()<\/code> returns a brand-new value.<\/p>\n\n<h2 id=\"what-is-temporal\">What is the JavaScript Temporal API?<\/h2>\n<p>The JavaScript Temporal API is a new standard date and time API designed by TC39, the committee that designs JavaScript. It is a global namespace object called <code>Temporal<\/code>, just like <code>Math<\/code> or <code>Intl<\/code>. Instead of one <code>Date<\/code> type that tries to do everything, Temporal gives you a small family of types, each with one clear job:<\/p>\n<figure>\n<svg viewBox=\"0 0 1100 470\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" role=\"img\" aria-label=\"Diagram of Temporal types: Instant and ZonedDateTime are exact moments, PlainDateTime, PlainDate, PlainTime, PlainYearMonth and PlainMonthDay are wall-clock values, and Duration is an amount of time\">\n<rect width=\"1100\" height=\"470\" fill=\"#0b1020\"\/>\n<text x=\"40\" y=\"44\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#c9d1ff\">EXACT MOMENT (same everywhere on Earth)<\/text>\n<g class=\"node\"><rect x=\"40\" y=\"64\" width=\"320\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#3178c6\" stroke-width=\"2\"\/><text x=\"200.0\" y=\"94\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">Temporal.Instant<\/text><text x=\"200.0\" y=\"118\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">a point on the timeline, always UTC<\/text><text x=\"200.0\" y=\"142\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">2026-10-31T13:30:00Z<\/text><\/g>\n<g class=\"node\"><rect x=\"400\" y=\"64\" width=\"420\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#7c5cff\" stroke-width=\"2\"\/><text x=\"610.0\" y=\"94\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">Temporal.ZonedDateTime<\/text><text x=\"610.0\" y=\"118\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">a moment + a time zone (handles daylight saving)<\/text><text x=\"610.0\" y=\"142\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">\u2026T19:00+05:30[Asia\/Kolkata]<\/text><\/g>\n<text x=\"40\" y=\"208\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#c9d1ff\">WALL-CLOCK VALUES (no time zone attached)<\/text>\n<g class=\"node\"><rect x=\"40\" y=\"228\" width=\"300\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#61dafb\" stroke-width=\"2\"\/><text x=\"190.0\" y=\"258\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">PlainDateTime<\/text><text x=\"190.0\" y=\"282\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">date + clock time<\/text><text x=\"190.0\" y=\"306\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">2026-11-08T19:00<\/text><\/g>\n<g class=\"node\"><rect x=\"370\" y=\"228\" width=\"220\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#89e051\" stroke-width=\"2\"\/><text x=\"480.0\" y=\"258\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">PlainDate<\/text><text x=\"480.0\" y=\"282\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">birthdays, holidays<\/text><text x=\"480.0\" y=\"306\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">2026-11-08<\/text><\/g>\n<g class=\"node\"><rect x=\"620\" y=\"228\" width=\"200\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#89e051\" stroke-width=\"2\"\/><text x=\"720.0\" y=\"258\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">PlainTime<\/text><text x=\"720.0\" y=\"282\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">opening hours<\/text><text x=\"720.0\" y=\"306\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">19:00<\/text><\/g>\n<g class=\"node\"><rect x=\"40\" y=\"340\" width=\"260\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#61dafb\" stroke-width=\"2\"\/><text x=\"170.0\" y=\"370\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">PlainYearMonth<\/text><text x=\"170.0\" y=\"394\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">card expiry, reports<\/text><text x=\"170.0\" y=\"418\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">2026-11<\/text><\/g>\n<g class=\"node\"><rect x=\"330\" y=\"340\" width=\"260\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#61dafb\" stroke-width=\"2\"\/><text x=\"460.0\" y=\"370\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">PlainMonthDay<\/text><text x=\"460.0\" y=\"394\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">yearly events<\/text><text x=\"460.0\" y=\"418\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">&#8211;11-08<\/text><\/g>\n<text x=\"860\" y=\"208\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#c9d1ff\">AMOUNT OF TIME<\/text>\n<g class=\"node\"><rect x=\"860\" y=\"228\" width=\"200\" height=\"92\" rx=\"12\" fill=\"#151b3b\" stroke=\"#f5b700\" stroke-width=\"2\"\/><text x=\"960.0\" y=\"258\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"19\" font-weight=\"800\" fill=\"#fff\">Duration<\/text><text x=\"960.0\" y=\"282\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">2 hours 15 minutes<\/text><text x=\"960.0\" y=\"306\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"13\" fill=\"#ce9178\">PT2H15M<\/text><\/g>\n<path d=\"M610 156 L 470 228\" stroke=\"#7c5cff\" stroke-width=\"2\" stroke-dasharray=\"5 5\"\/>\n<text x=\"560\" y=\"200\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"13\" fill=\"#a99bff\">.toPlainDate()<\/text>\n<path d=\"M360 110 H 400\" stroke=\"#3178c6\" stroke-width=\"3\"\/>\n<text x=\"640\" y=\"400\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">Rule of thumb: store an Instant,<\/text>\n<text x=\"640\" y=\"424\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">show a ZonedDateTime, use Plain types for &#8220;calendar&#8221; data.<\/text>\n<\/svg>\n<figcaption>The Temporal family: exact moments on top, wall-clock values in the middle, and Duration for &#8220;how long&#8221;.<\/figcaption>\n<\/figure>\n<p>Three ideas make Temporal easy to work with once you get used to them:<\/p>\n<ol class=\"dd-steps\">\n<li><b>Pick the type that matches your data.<\/b> A birthday has no time zone, so it is a <code>PlainDate<\/code>. A flight departure happens in one place at one moment, so it is a <code>ZonedDateTime<\/code>.<\/li>\n<li><b>Everything is immutable.<\/b> Methods like <code>add()<\/code>, <code>subtract()<\/code>, <code>with()<\/code> and <code>round()<\/code> always return a new object.<\/li>\n<li><b>Strings are strict ISO 8601.<\/b> Temporal reads and writes formats like <code>2026-11-08T19:00<\/code> and refuses vague strings such as <code>\"11\/08\/2026\"<\/code> that could mean two different days.<\/li>\n<\/ol>\n<div class=\"dd-note\"><b>Note:<\/b> The full reference lives on <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Temporal\" rel=\"noopener\" target=\"_blank\">MDN&#8217;s Temporal page<\/a>, and the proposal team keeps a detailed <a href=\"https:\/\/tc39.es\/proposal-temporal\/docs\/\" rel=\"noopener\" target=\"_blank\">Temporal documentation and cookbook<\/a>.<\/div>\n\n<h2 id=\"where-to-use\">Where can you use Temporal today?<\/h2>\n<p>Node.js 26 ships with Temporal turned on by default, so server-side code and scripts can use it with no install and no flag. Firefox and Chromium-based browsers such as Chrome and Edge also ship it in their recent versions, while support in some other browsers is still rolling out. Always check the compatibility table on MDN before you rely on it in front-end code, and use a polyfill if you need to support older browsers.<\/p>\n<div class=\"dd-vsc dd-vsc-termonly\" role=\"group\" aria-label=\"Terminal: Terminal \u2014 check your Node.js version\"><div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">Terminal \u2014 check your Node.js version<\/span><\/div><pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\"># Temporal is built in from Node.js 26 - check what you have<\/span><\/span>\n<span class=\"l\"><span class=\"gp\">$<\/span> node -v<\/span>\n<span class=\"l\">v26.13.0<\/span>\n<span class=\"l\"><span class=\"gp\">$<\/span> node -e \"console.log(typeof Temporal)\"<\/span>\n<span class=\"l\">object<\/span>\n<span class=\"l\"><span class=\"c\"># \"undefined\" means your runtime has no Temporal yet - use the polyfill below<\/span><\/span><\/code><\/pre><\/div>\n<div class=\"dd-tip\"><b>Tip:<\/b> New to Node.js? Start with our <a href=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/23\/nodejs-series-part-1-what-is-nodejs\/\">Node.js Part 1: What Is Node.js<\/a> guide, then read <a href=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/30\/nodejs-series-part-2-modules-esm-commonjs\/\">Node.js Part 2 on ES Modules<\/a> &#8211; all examples in this post are <code>.mjs<\/code> ES module files.<\/div>\n<\/div>\n\n\n\n<div class=\"dd-post\">\n<h2 id=\"plain-types\">Plain dates and times (no time zone)<\/h2>\n<p>&#8220;Plain&#8221; means &#8220;wall-clock value with no time zone attached&#8221;. It is the right choice for most calendar data: birthdays, holidays, shop opening hours, a due date on a to-do list. You create plain values with <code>from()<\/code>, and you can read individual parts like <code>year<\/code>, <code>month<\/code> and <code>dayOfWeek<\/code> as simple numbers.<\/p>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: basics.mjs\">\n<input type=\"radio\" name=\"v2\" id=\"v2f1\" class=\"f1\" checked>\n<input type=\"checkbox\" id=\"v2r1\" class=\"r1\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">basics.mjs \u2014 temporal-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v2f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>basics.mjs<\/label>\n<label for=\"v2r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a basics.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ Temporal basics: pick the type that matches your data<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">today<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">Now<\/span>.<span class=\"nf\">plainDateISO<\/span>();          <span class=\"c\">\/\/ just a date<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">time<\/span>  = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainTime<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'19:00'<\/span>);     <span class=\"c\">\/\/ just a clock time<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">meet<\/span>  = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDateTime<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-11-08T19:00'<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Today is'<\/span>, <span class=\"n\">today<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Time    '<\/span>, <span class=\"n\">time<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Meeting '<\/span>, <span class=\"n\">meet<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Math is simple and never changes the original value<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">nextWeek<\/span> = <span class=\"n\">meet<\/span>.<span class=\"nf\">add<\/span>({ <span class=\"n\">days<\/span>: <span class=\"m\">7<\/span> });<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Next week'<\/span>, <span class=\"n\">nextWeek<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Earlier?'<\/span>, <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDateTime<\/span>.<span class=\"nf\">compare<\/span>(<span class=\"n\">meet<\/span>, <span class=\"n\">nextWeek<\/span>)); <span class=\"c\">\/\/ -1<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Read the parts you need<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">meet<\/span>.<span class=\"n\">year<\/span>, <span class=\"n\">meet<\/span>.<span class=\"n\">month<\/span>, <span class=\"n\">meet<\/span>.<span class=\"n\">day<\/span>, <span class=\"n\">meet<\/span>.<span class=\"n\">hour<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Weekday number (Mon=1):'<\/span>, <span class=\"n\">meet<\/span>.<span class=\"n\">dayOfWeek<\/span>);<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, run on 31 Oct)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node basics.mjs\nToday is 2026-10-31\nTime     19:00:00\nMeeting  2026-11-08T19:00:00\nNext week 2026-11-15T19:00:00\nEarlier? -1\n2026 11 8 19\nWeekday number (Mon=1): 7<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 17, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<p class=\"dd-vsc-hint\">Press <b>\u25b6 Run<\/b> to open the terminal. &#8220;Today&#8221; will be your own date when you run it.<\/p>\n<p>A few things to notice:<\/p>\n<ul>\n<li><code>Temporal.Now.plainDateISO()<\/code> gives today&#8217;s date in the computer&#8217;s time zone. Use <code>Temporal.Now.instant()<\/code> when you need the exact current moment.<\/li>\n<li>You cannot compare Temporal objects with <code>&lt;<\/code> or <code>&gt;<\/code>. Use the static <code>compare()<\/code> method (it returns -1, 0 or 1, perfect for <code>Array.sort()<\/code>) or <code>equals()<\/code>.<\/li>\n<li><code>dayOfWeek<\/code> runs from 1 (Monday) to 7 (Sunday), following the ISO standard. 8 November 2026 is a Sunday, so it prints 7.<\/li>\n<\/ul>\n\n<h2 id=\"time-zones\">Time zones and daylight saving with ZonedDateTime<\/h2>\n<p>This is where Temporal really shines. A <code>ZonedDateTime<\/code> is an exact moment plus an IANA time zone name such as <code>Asia\/Kolkata<\/code> or <code>America\/New_York<\/code>. Because it knows the zone&#8217;s rules, it can show the same moment in any city and it handles daylight saving correctly.<\/p>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: timezones.mjs, dst.mjs\">\n<input type=\"radio\" name=\"v3\" id=\"v3f1\" class=\"f1\" checked>\n<input type=\"radio\" name=\"v3\" id=\"v3f2\" class=\"f2\">\n<input type=\"checkbox\" id=\"v3r1\" class=\"r1\">\n<input type=\"checkbox\" id=\"v3r2\" class=\"r2\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">timezones.mjs \u2014 temporal-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v3f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>timezones.mjs<\/label>\n<label for=\"v3f2\" class=\"t2\"><b class=\"ic js\">JS<\/b>dst.mjs<\/label>\n<label for=\"v3r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<label for=\"v3r2\" class=\"run run2\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a timezones.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ A webinar at 7:00 PM in India - what time is it for everyone else?<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">webinar<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">ZonedDateTime<\/span>.<span class=\"nf\">from<\/span>(<\/span>\n<span class=\"l\">  <span class=\"s\">'2026-11-08T19:00[Asia\/Kolkata]'<\/span><\/span>\n<span class=\"l\">);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"k\">for<\/span> (<span class=\"kc\">const<\/span> <span class=\"n\">zone<\/span> <span class=\"k\">of<\/span> [<span class=\"s\">'Asia\/Kolkata'<\/span>, <span class=\"s\">'Europe\/London'<\/span>, <span class=\"s\">'America\/New_York'<\/span>, <span class=\"s\">'Asia\/Tokyo'<\/span>]) {<\/span>\n<span class=\"l\">  <span class=\"kc\">const<\/span> <span class=\"n\">local<\/span> = <span class=\"n\">webinar<\/span>.<span class=\"nf\">withTimeZone<\/span>(<span class=\"n\">zone<\/span>);<\/span>\n<span class=\"l\">  <span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">zone<\/span>.<span class=\"nf\">padEnd<\/span>(<span class=\"m\">17<\/span>), <span class=\"n\">local<\/span>.<span class=\"nf\">toPlainDateTime<\/span>().<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\">}<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ The exact moment never changes, only how we display it<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Same instant?'<\/span>, <span class=\"n\">webinar<\/span>.<span class=\"nf\">withTimeZone<\/span>(<span class=\"s\">'Asia\/Tokyo'<\/span>).<span class=\"n\">epochMilliseconds<\/span> === <span class=\"n\">webinar<\/span>.<span class=\"n\">epochMilliseconds<\/span>);<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, Linux)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node timezones.mjs\nAsia\/Kolkata      2026-11-08T19:00:00\nEurope\/London     2026-11-08T13:30:00\nAmerica\/New_York  2026-11-08T08:30:00\nAsia\/Tokyo        2026-11-08T22:30:00\nSame instant? true<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 12, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<div class=\"dd-vsc-pane p2\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a dst.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ Daylight saving: New York clocks go back on 1 Nov 2026<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">before<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">ZonedDateTime<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-10-31T09:00[America\/New_York]'<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">plusDay<\/span>   = <span class=\"n\">before<\/span>.<span class=\"nf\">add<\/span>({ <span class=\"n\">days<\/span>: <span class=\"m\">1<\/span> });   <span class=\"c\">\/\/ same wall-clock time next day<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">plus24h<\/span>   = <span class=\"n\">before<\/span>.<span class=\"nf\">add<\/span>({ <span class=\"n\">hours<\/span>: <span class=\"m\">24<\/span> }); <span class=\"c\">\/\/ exactly 24 real hours later<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'add 1 day  :'<\/span>, <span class=\"n\">plusDay<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'add 24 hrs :'<\/span>, <span class=\"n\">plus24h<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Hours in 1 Nov:'<\/span>, <span class=\"n\">plusDay<\/span>.<span class=\"n\">hoursInDay<\/span>);<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, Linux)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node dst.mjs\nadd 1 day  : 2026-11-01T09:00:00-05:00[America\/New_York]\nadd 24 hrs : 2026-11-01T08:00:00-05:00[America\/New_York]\nHours in 1 Nov: 25<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 9, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<p class=\"dd-vsc-hint\">Two files: one meeting shown in four cities, and a daylight saving example. Switch tabs and press <b>\u25b6 Run<\/b>.<\/p>\n<p>In the first file, a webinar planned for 7:00 PM in India is shown in London, New York and Tokyo with one method call: <code>withTimeZone()<\/code>. The underlying moment stays the same, which the last line proves by comparing <code>epochMilliseconds<\/code>.<\/p>\n<p>The second file is the classic daylight saving trap. New York moves its clocks back one hour on 1 November 2026, so that day has 25 hours. Temporal lets you say exactly what you mean:<\/p>\n<figure>\n<svg viewBox=\"0 0 1100 330\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" role=\"img\" aria-label=\"Timeline showing that across the New York daylight saving change on 1 November, adding one day keeps 9 AM while adding 24 hours gives 8 AM\">\n<rect width=\"1100\" height=\"330\" fill=\"#0b1020\"\/>\n<text x=\"40\" y=\"44\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"20\" font-weight=\"800\" fill=\"#c9d1ff\">New York, clocks go back from 2:00 AM to 1:00 AM on 1 Nov<\/text>\n<line x1=\"60\" y1=\"170\" x2=\"1040\" y2=\"170\" stroke=\"#3a4380\" stroke-width=\"4\"\/>\n<circle cx=\"120\" cy=\"170\" r=\"10\" fill=\"#89e051\"\/>\n<text x=\"120\" y=\"215\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"16\" fill=\"#fff\">31 Oct, 9:00 AM<\/text>\n<text x=\"120\" y=\"238\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#aab4e8\">start<\/text>\n<rect x=\"610\" y=\"140\" width=\"80\" height=\"60\" rx=\"8\" fill=\"#e08a00\" opacity=\".25\"\/>\n<text x=\"650\" y=\"128\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"14\" fill=\"#ffcf7a\">1 AM happens twice<\/text>\n<g class=\"node\"><circle cx=\"880\" cy=\"170\" r=\"10\" fill=\"#61dafb\"\/>\n<text x=\"880\" y=\"215\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"16\" fill=\"#fff\">8:00 AM<\/text>\n<text x=\"880\" y=\"238\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"14\" fill=\"#ce9178\">add({ hours: 24 })<\/text><\/g>\n<g class=\"node\"><circle cx=\"960\" cy=\"170\" r=\"10\" fill=\"#7c5cff\"\/>\n<text x=\"975\" y=\"110\" text-anchor=\"middle\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"16\" fill=\"#fff\">9:00 AM<\/text>\n<text x=\"975\" y=\"88\" text-anchor=\"middle\" font-family=\"Consolas,monospace\" font-size=\"14\" fill=\"#ce9178\">add({ days: 1 })<\/text><\/g>\n<path d=\"M120 160 Q 540 40 960 160\" fill=\"none\" stroke=\"#7c5cff\" stroke-width=\"2\" stroke-dasharray=\"6 6\"\/>\n<path d=\"M120 180 Q 500 300 880 180\" fill=\"none\" stroke=\"#61dafb\" stroke-width=\"2\" stroke-dasharray=\"6 6\"\/>\n<circle r=\"6\" fill=\"#7c5cff\"><animateMotion dur=\"3s\" repeatCount=\"indefinite\" path=\"M120 160 Q 540 40 960 160\"\/><\/circle>\n<circle r=\"6\" fill=\"#61dafb\"><animateMotion dur=\"3s\" repeatCount=\"indefinite\" path=\"M120 180 Q 500 300 880 180\"\/><\/circle>\n<text x=\"40\" y=\"300\" font-family=\"Segoe UI,Arial,sans-serif\" font-size=\"15\" fill=\"#aab4e8\">1 Nov has 25 hours, so &#8220;one day later&#8221; and &#8220;24 hours later&#8221; are different clock times.<\/text>\n<\/svg>\n<figcaption>Daylight saving in action: <code>days<\/code> follow the calendar, <code>hours<\/code> follow real elapsed time.<\/figcaption>\n<\/figure>\n<div class=\"dd-warn\"><b>Watch out:<\/b> India does not use daylight saving, so you may never notice this bug while testing locally. Your users in the US, UK, Europe or Australia will. Always use <code>ZonedDateTime<\/code> for real-world events that repeat across those dates.<\/div>\n<\/div>\n\n\n\n<div class=\"dd-post\">\n<h2 id=\"durations\">Durations, differences and formatting<\/h2>\n<p>Subtracting two <code>Date<\/code> objects gives you milliseconds, and you have to do the maths for days, months and years yourself (and months have different lengths!). Temporal&#8217;s <code>until()<\/code> and <code>since()<\/code> return a <code>Temporal.Duration<\/code> that already knows about calendars.<\/p>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: durations.mjs\">\n<input type=\"radio\" name=\"v4\" id=\"v4f1\" class=\"f1\" checked>\n<input type=\"checkbox\" id=\"v4r1\" class=\"r1\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">durations.mjs \u2014 temporal-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v4f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>durations.mjs<\/label>\n<label for=\"v4r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a durations.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ How long between two dates?<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">joined<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2024-03-16'<\/span>);<\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">today<\/span>  = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-10-31'<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">gap<\/span> = <span class=\"n\">joined<\/span>.<span class=\"nf\">until<\/span>(<span class=\"n\">today<\/span>, { <span class=\"n\">largestUnit<\/span>: <span class=\"s\">'years'<\/span> });<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">gap<\/span>.<span class=\"nf\">toString<\/span>());                       <span class=\"c\">\/\/ ISO 8601 duration<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">`${<\/span><span class=\"n\">gap<\/span>.<span class=\"n\">years<\/span><span class=\"s\">} years, ${<\/span><span class=\"n\">gap<\/span>.<span class=\"n\">months<\/span><span class=\"s\">} months, ${<\/span><span class=\"n\">gap<\/span>.<span class=\"n\">days<\/span><span class=\"s\">} days`<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Total days, and a duration rounded for humans<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">'Total days:'<\/span>, <span class=\"n\">joined<\/span>.<span class=\"nf\">until<\/span>(<span class=\"n\">today<\/span>).<span class=\"n\">days<\/span>);<\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">d<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">Duration<\/span>.<span class=\"nf\">from<\/span>({ <span class=\"n\">minutes<\/span>: <span class=\"m\">135<\/span> });<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">d<\/span>.<span class=\"nf\">round<\/span>({ <span class=\"n\">largestUnit<\/span>: <span class=\"s\">'hours'<\/span> }).<span class=\"nf\">toString<\/span>()); <span class=\"c\">\/\/ PT2H15M<\/span><\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Format with the user's language<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">today<\/span>.<span class=\"nf\">toLocaleString<\/span>(<span class=\"s\">'en-IN'<\/span>, { <span class=\"n\">dateStyle<\/span>: <span class=\"s\">'full'<\/span> }));<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">today<\/span>.<span class=\"nf\">toLocaleString<\/span>(<span class=\"s\">'en-US'<\/span>, { <span class=\"n\">dateStyle<\/span>: <span class=\"s\">'medium'<\/span> }));<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, Linux)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node durations.mjs\nP2Y7M15D\n2 years, 7 months, 15 days\nTotal days: 959\nPT2H15M\nSaturday, 31 October 2026\nOct 31, 2026<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 16, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<ul>\n<li><code>largestUnit<\/code> controls how the result is split. Without it, a <code>PlainDate<\/code> difference is given in days (959 here).<\/li>\n<li><code>P2Y7M15D<\/code> is the ISO 8601 way of writing &#8220;2 years, 7 months, 15 days&#8221;. You can send it in JSON and read it back with <code>Temporal.Duration.from()<\/code>.<\/li>\n<li><code>toLocaleString()<\/code> uses the built-in <code>Intl<\/code> formatter, so <code>en-IN<\/code> and <code>en-US<\/code> users each get the format they expect. No formatting library is needed for most screens.<\/li>\n<\/ul>\n\n<h2 id=\"convert\">Converting between Date and Temporal<\/h2>\n<p>You do not have to rewrite your whole app in one go. Many libraries, databases and APIs still give you <code>Date<\/code> objects, so you will move between the two often. The bridge is the <code>Instant<\/code> type:<\/p>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: convert.mjs\">\n<input type=\"radio\" name=\"v5\" id=\"v5f1\" class=\"f1\" checked>\n<input type=\"checkbox\" id=\"v5r1\" class=\"r1\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">convert.mjs \u2014 temporal-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v5f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>convert.mjs<\/label>\n<label for=\"v5r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-demo \u203a convert.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ Moving between Date and Temporal<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">legacy<\/span> = new <span class=\"nc\">Date<\/span>(<span class=\"s\">'2026-10-31T13:30:00Z'<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">instant<\/span> = <span class=\"n\">legacy<\/span>.<span class=\"nf\">toTemporalInstant<\/span>();        <span class=\"c\">\/\/ Date -&gt; Temporal.Instant<\/span><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">inIndia<\/span> = <span class=\"n\">instant<\/span>.<span class=\"nf\">toZonedDateTimeISO<\/span>(<span class=\"s\">'Asia\/Kolkata'<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">inIndia<\/span>.<span class=\"nf\">toString<\/span>());<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">back<\/span> = new <span class=\"nc\">Date<\/span>(<span class=\"n\">inIndia<\/span>.<span class=\"n\">epochMilliseconds<\/span>);  <span class=\"c\">\/\/ Temporal -&gt; Date<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"n\">back<\/span>.<span class=\"nf\">toISOString<\/span>());<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"c\">\/\/ Store instants in the database as UTC strings<\/span><\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"nc\">JSON<\/span>.<span class=\"nf\">stringify<\/span>({ <span class=\"n\">createdAt<\/span>: <span class=\"n\">instant<\/span> }));<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 26.13, Linux)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node convert.mjs\n2026-10-31T19:00:00+05:30[Asia\/Kolkata]\n2026-10-31T13:30:00.000Z\n{\"createdAt\":\"2026-10-31T13:30:00Z\"}<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 12, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<p><code>Date.prototype.toTemporalInstant()<\/code> turns an old <code>Date<\/code> into an <code>Instant<\/code>, and <code>epochMilliseconds<\/code> takes you back. When you save to a database or send JSON, an <code>Instant<\/code> becomes a plain UTC string, which every backend understands.<\/p>\n<div class=\"dd-tip\"><b>Tip:<\/b> Preparing for interviews? &#8220;How do you handle time zones in Node.js?&#8221; is a common question. Our <a href=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/12\/nodejs-interview-questions\/\">Node.js interview questions guide<\/a> covers the event loop and async topics that often come up next.<\/div>\n\n<h2 id=\"polyfill\">Using the polyfill in browsers and older Node.js<\/h2>\n<p>If your users are on browsers without Temporal, or your server still runs Node.js 22 or 24, install a polyfill. It gives you the same API, so your code will keep working when you later remove it.<\/p>\n<div class=\"dd-vsc dd-vsc-termonly\" role=\"group\" aria-label=\"Terminal: Terminal \u2014 install the polyfill\"><div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">Terminal \u2014 install the polyfill<\/span><\/div><pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\"># For browsers without Temporal, or Node.js 24 and older<\/span><\/span>\n<span class=\"l\"><span class=\"gp\">$<\/span> npm install temporal-polyfill<\/span>\n<span class=\"l\"><span class=\"c\"># Another option is the reference polyfill from the proposal champions:<\/span><\/span>\n<span class=\"l\"><span class=\"gp\">$<\/span> npm install @js-temporal\/polyfill<\/span><\/code><\/pre><\/div>\n<div class=\"dd-vsc\" role=\"group\" aria-label=\"Code editor: polyfill.mjs\">\n<input type=\"radio\" name=\"v6\" id=\"v6f1\" class=\"f1\" checked>\n<input type=\"checkbox\" id=\"v6r1\" class=\"r1\">\n<div class=\"dd-vsc-bar\"><span class=\"dd-dots\"><i><\/i><i><\/i><i><\/i><\/span><span class=\"dd-vsc-title\">polyfill.mjs \u2014 temporal-polyfill-demo \u2014 Visual Studio Code<\/span><\/div>\n<div class=\"dd-vsc-tabs\">\n<label for=\"v6f1\" class=\"t1\"><b class=\"ic js\">JS<\/b>polyfill.mjs<\/label>\n<label for=\"v6r1\" class=\"run run1\" title=\"Show the output in the terminal\">\u25b6 Run<\/label>\n<\/div>\n<div class=\"dd-vsc-pane p1\">\n<div class=\"dd-vsc-crumbs\">temporal-polyfill-demo \u203a polyfill.mjs<\/div>\n<pre class=\"dd-vsc-code\"><code><span class=\"l\"><span class=\"c\">\/\/ Works in any modern browser or older Node.js (e.g. Node 22)<\/span><\/span>\n<span class=\"l\"><span class=\"k\">import<\/span> { <span class=\"nc\">Temporal<\/span> } <span class=\"k\">from<\/span> <span class=\"s\">'temporal-polyfill'<\/span>;<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">deadline<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-12-31'<\/span>);<\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">today<\/span> = <span class=\"nc\">Temporal<\/span>.<span class=\"n\">PlainDate<\/span>.<span class=\"nf\">from<\/span>(<span class=\"s\">'2026-10-31'<\/span>);<\/span>\n<span class=\"l\"><\/span>\n<span class=\"l\"><span class=\"kc\">const<\/span> <span class=\"n\">left<\/span> = <span class=\"n\">today<\/span>.<span class=\"nf\">until<\/span>(<span class=\"n\">deadline<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">`Days left this year: ${<\/span><span class=\"n\">left<\/span>.<span class=\"n\">days<\/span><span class=\"s\">}`<\/span>);<\/span>\n<span class=\"l\"><span class=\"nb\">console<\/span>.<span class=\"nf\">log<\/span>(<span class=\"s\">`Runtime: Node.js ${<\/span><span class=\"n\">process<\/span>.<span class=\"n\">version<\/span><span class=\"s\">}`<\/span>);<\/span><\/code><\/pre>\n<div class=\"dd-vsc-term\"><div class=\"dd-term-head\"><span>TERMINAL<\/span><span>OUTPUT<\/span><span>PROBLEMS<\/span><span class=\"dd-term-note\">Real output (Node.js 22 + temporal-polyfill 1.0.6)<\/span><\/div><pre><code><span class=\"gp\">$<\/span> node polyfill.mjs\nDays left this year: 61\nRuntime: Node.js v22.23.4<\/code><\/pre><\/div>\n<div class=\"dd-vsc-status\"><span>\u2387 main<\/span><span>Ln 9, Col 1<\/span><span class=\"sp\"><\/span><span>Spaces: 2<\/span><span>UTF-8<\/span><span>LF<\/span><span>JavaScript<\/span><\/div>\n<\/div>\n<\/div>\n<p class=\"dd-vsc-hint\">This one runs on Node.js 22, which has no built-in Temporal, so the polyfill fills the gap.<\/p>\n<div class=\"dd-note\"><b>TypeScript users:<\/b> recent TypeScript versions include Temporal types when you target a modern <code>lib<\/code> setting. If yours does not, the polyfill package ships its own types. See our <a href=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/07\/typescript-7-migration-guide\/\">TypeScript 7 migration guide<\/a> for setting up <code>tsconfig<\/code>.<\/div>\n<\/div>\n\n\n\n<div class=\"dd-post\">\n<h2 id=\"which-type\">Which Temporal type should I use?<\/h2>\n<p>Choosing the right type is the one real decision Temporal asks you to make. Pick a situation below to see the recommended type:<\/p>\n<div class=\"dd-tabs\" role=\"group\" aria-label=\"Which Temporal type should I use?\">\n<input type=\"radio\" name=\"tpick\" id=\"ti1\" checked><input type=\"radio\" name=\"tpick\" id=\"ti2\"><input type=\"radio\" name=\"tpick\" id=\"ti3\"><input type=\"radio\" name=\"tpick\" id=\"ti4\">\n<div class=\"labels\"><label for=\"ti1\">Birthday or holiday<\/label><label for=\"ti2\">Online meeting<\/label><label for=\"ti3\">Log or database timestamp<\/label><label for=\"ti4\">Countdown or timer<\/label><\/div>\n<div class=\"panel p1\"><p><b>Use <code>Temporal.PlainDate<\/code>.<\/b> A birthday is &#8220;8 November&#8221; for everyone, no matter where they are. If you store it with a time zone, it can show up one day early for users in another country &#8211; a very common bug with <code>Date<\/code>.<\/p><p><code>Temporal.PlainDate.from('2026-11-08')<\/code><\/p><\/div>\n<div class=\"panel p2\"><p><b>Use <code>Temporal.ZonedDateTime<\/code>.<\/b> A meeting happens at one exact moment, but each person sees it in their own local time. Create it in the organiser&#8217;s zone, then call <code>withTimeZone()<\/code> for each viewer.<\/p><p><code>Temporal.ZonedDateTime.from('2026-11-08T19:00[Asia\/Kolkata]')<\/code><\/p><\/div>\n<div class=\"panel p3\"><p><b>Use <code>Temporal.Instant<\/code>.<\/b> Logs, &#8220;created at&#8221; columns and API responses need the exact moment, not a local clock reading. Store it as a UTC string like <code>2026-10-31T13:30:00Z<\/code> and convert to a time zone only when you display it.<\/p><p><code>Temporal.Now.instant()<\/code><\/p><\/div>\n<div class=\"panel p4\"><p><b>Use <code>Temporal.Duration<\/code><\/b> together with <code>until()<\/code> or <code>since()<\/code>. It keeps years, months, days and hours separate, and <code>round()<\/code> or <code>total()<\/code> turn it into something you can show.<\/p><p><code>today.until(deadline, { largestUnit: 'days' })<\/code><\/p><\/div>\n<\/div>\n\n<h2 id=\"errors\">Common errors and fixes<\/h2>\n<p>Temporal fails loudly instead of guessing. These are real error messages from Node.js 26:<\/p>\n<div class=\"dd-tablewrap\"><table>\n<thead><tr><th>Error message<\/th><th>Why it happens<\/th><th>Fix<\/th><\/tr><\/thead>\n<tbody>\n<tr><td><code>TypeError: Do not use Temporal.PlainDate.prototype.valueOf; use ... compare for comparison.<\/code><\/td><td>You compared two Temporal values with <code>&lt;<\/code>, <code>&gt;<\/code> or used them in maths.<\/td><td>Use <code>Temporal.PlainDate.compare(a, b)<\/code> or <code>a.equals(b)<\/code>.<\/td><\/tr>\n<tr><td><code>RangeError: ... Time zone annotation is required for parsing a zoned date time.<\/code><\/td><td>You passed <code>'2026-11-08T19:00'<\/code> to <code>ZonedDateTime.from()<\/code> without a zone.<\/td><td>Add the zone in brackets: <code>'2026-11-08T19:00[Asia\/Kolkata]'<\/code>.<\/td><\/tr>\n<tr><td><code>RangeError: ... Parsed day value not in a valid range.<\/code><\/td><td>The string has an impossible date such as 30 February.<\/td><td>Validate user input, or build from an object, which clamps to the last valid day by default.<\/td><\/tr>\n<tr><td><code>RangeError: ... Invalid ISO date.<\/code><\/td><td>You used a zero-based month like with <code>Date<\/code>: <code>new Temporal.PlainDate(2026, 0, 1)<\/code>.<\/td><td>Months start at 1 in Temporal: <code>new Temporal.PlainDate(2026, 1, 1)<\/code>.<\/td><\/tr>\n<tr><td><code>RangeError: ... Required fields missing from Instant string.<\/code><\/td><td><code>Instant.from()<\/code> needs an exact moment, so a string without <code>Z<\/code> or an offset is rejected.<\/td><td>Use <code>'2026-11-08T13:30Z'<\/code>, or parse as <code>ZonedDateTime<\/code> and call <code>toInstant()<\/code>.<\/td><\/tr>\n<tr><td><code>ReferenceError: Temporal is not defined<\/code><\/td><td>Your runtime does not ship Temporal yet (for example Node.js 22).<\/td><td>Upgrade to Node.js 26 or import from <code>temporal-polyfill<\/code>.<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n<h2 id=\"best-practices\">Best practices for working with dates in JavaScript<\/h2>\n<ol class=\"dd-steps\">\n<li><b>Store instants, display zoned times.<\/b> Save timestamps as UTC <code>Instant<\/code> strings and convert to the viewer&#8217;s zone only in the UI.<\/li>\n<li><b>Keep the time zone name, not just the offset.<\/b> <code>+05:30<\/code> tells you the offset today; <code>Asia\/Kolkata<\/code> tells Temporal the rules for every date, including daylight saving in other countries.<\/li>\n<li><b>Use Plain types for &#8220;calendar&#8221; data.<\/b> Birthdays, due dates and holidays should never shift because a user travels.<\/li>\n<li><b>Be explicit about units.<\/b> Choose <code>days<\/code> vs <code>hours<\/code> on purpose, and pass <code>largestUnit<\/code> to <code>until()<\/code>.<\/li>\n<li><b>Validate input early.<\/b> Wrap <code>from()<\/code> in <code>try\/catch<\/code> for user-entered strings and show a friendly message on <code>RangeError<\/code>.<\/li>\n<li><b>Migrate gradually.<\/b> Convert at the edges with <code>toTemporalInstant()<\/code> and remove date libraries like Moment.js one module at a time.<\/li>\n<\/ol>\n\n<h2 id=\"faq\">FAQ<\/h2>\n<details><summary>Is Temporal a replacement for the Date object?<\/summary><p>For new code, yes. <code>Date<\/code> is not going away because millions of websites depend on it, but Temporal is the recommended way to work with dates and times in modern JavaScript.<\/p><\/details>\n<details><summary>Do I still need Moment.js, date-fns or Day.js?<\/summary><p>For most apps, no. Time zones, durations, calendar maths and formatting (via <code>toLocaleString<\/code>) are built in. You might still use a library for special formatting like &#8220;3 days ago&#8221;, although <code>Intl.RelativeTimeFormat<\/code> covers that too.<\/p><\/details>\n<details><summary>Which Node.js version supports Temporal?<\/summary><p>Node.js 26 enables Temporal by default. On Node.js 24 and older, install <code>temporal-polyfill<\/code> or <code>@js-temporal\/polyfill<\/code> and import <code>Temporal<\/code> from it.<\/p><\/details>\n<details><summary>How do I store Temporal values in a database?<\/summary><p>Call <code>toString()<\/code> (or let <code>JSON.stringify<\/code> do it). Store an <code>Instant<\/code> in a UTC timestamp column, and if the original zone matters, store the zone name such as <code>Asia\/Kolkata<\/code> in a separate column.<\/p><\/details>\n<details><summary>Does Temporal work with React, Angular or Vue?<\/summary><p>Yes. It is plain JavaScript, so it works in any framework. Just remember that Temporal objects are not plain JSON objects; convert them to strings before putting them in state that gets serialized.<\/p><\/details>\n\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>The JavaScript Temporal API finally gives developers a date and time toolkit that matches how time works in the real world: dates without time zones, exact moments, proper time zone and daylight saving rules, and durations that understand calendars. Start using it in your Node.js 26 scripts today, add the polyfill for the browser, and convert your old <code>Date<\/code> code one module at a time.<\/p>\n<div class=\"dd-tip\"><b>Practice task:<\/b> Write a small script that takes a meeting time in your city and prints it for three teammates in other countries, plus how many days are left until it. You will use <code>ZonedDateTime<\/code>, <code>withTimeZone()<\/code> and <code>until()<\/code> &#8211; everything from this post.<\/div>\n<div class=\"dd-cta\"><h3>New posts every day on DevDojo<\/h3><p>Hands-on tutorials on JavaScript, Node.js, React, AI and DevOps &#8211; with runnable code and real output. Bookmark <a href=\"https:\/\/devdojo.co.in\/\">devdojo.co.in<\/a> and follow along with our daily series.<\/p><\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.<\/p>\n","protected":false},"author":1,"featured_media":277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,20,8],"tags":[145,96,83,43,144,146],"class_list":["post-276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-frontend","category-javascript","category-nodejs","tag-date-and-time","tag-frontend-tutorial","tag-javascript","tag-node-js","tag-temporal-api","tag-time-zones"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Lokendra\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DevDojo - Empowering Developers\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right\" \/>\n\t\t<meta property=\"og:description\" content=\"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-31T13:07:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-31T13:07:22+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#blogposting\",\"name\":\"JavaScript Temporal API Tutorial: Dates & Time Zones\",\"headline\":\"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right\",\"author\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/author\\\/lokendra\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/javascript-temporal-api-tutorial.jpg\",\"width\":1200,\"height\":630,\"caption\":\"JavaScript Temporal API tutorial banner showing one instant as local times in India, London, New York and Tokyo\"},\"datePublished\":\"2026-10-31T13:07:22+00:00\",\"dateModified\":\"2026-10-31T13:07:22+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#webpage\"},\"articleSection\":\"Frontend, JavaScript, NodeJS, Date and Time, Frontend Tutorial, JavaScript, Node.js, Temporal API, Time Zones\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/devdojo.co.in\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/#listItem\",\"name\":\"Backend\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/#listItem\",\"position\":2,\"name\":\"Backend\",\"item\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/nodejs\\\/#listItem\",\"name\":\"NodeJS\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/nodejs\\\/#listItem\",\"position\":3,\"name\":\"NodeJS\",\"item\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/nodejs\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#listItem\",\"name\":\"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/#listItem\",\"name\":\"Backend\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#listItem\",\"position\":4,\"name\":\"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/category\\\/backend\\\/nodejs\\\/#listItem\",\"name\":\"NodeJS\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#organization\",\"name\":\"DevDojo\",\"description\":\"Empowering Developers\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/author\\\/lokendra\\\/#author\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/author\\\/lokendra\\\/\",\"name\":\"Lokendra\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/99f102f0cc9080237ce54b91304fd1b3b6fa29925cbaeba93cd796872e58b45c?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Lokendra\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#webpage\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/\",\"name\":\"JavaScript Temporal API Tutorial: Dates & Time Zones\",\"description\":\"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/author\\\/lokendra\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/author\\\/lokendra\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/javascript-temporal-api-tutorial.jpg\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#mainImage\",\"width\":1200,\"height\":630,\"caption\":\"JavaScript Temporal API tutorial banner showing one instant as local times in India, London, New York and Tokyo\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/index.php\\\/2026\\\/10\\\/31\\\/javascript-temporal-api-tutorial\\\/#mainImage\"},\"datePublished\":\"2026-10-31T13:07:22+00:00\",\"dateModified\":\"2026-10-31T13:07:22+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#website\",\"url\":\"https:\\\/\\\/devdojo.co.in\\\/\",\"name\":\"DevDojo\",\"description\":\"Empowering Developers\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/devdojo.co.in\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"JavaScript Temporal API Tutorial: Dates & Time Zones","description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.","canonical_url":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#blogposting","name":"JavaScript Temporal API Tutorial: Dates & Time Zones","headline":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","author":{"@id":"https:\/\/devdojo.co.in\/index.php\/author\/lokendra\/#author"},"publisher":{"@id":"https:\/\/devdojo.co.in\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/devdojo.co.in\/wp-content\/uploads\/2026\/10\/javascript-temporal-api-tutorial.jpg","width":1200,"height":630,"caption":"JavaScript Temporal API tutorial banner showing one instant as local times in India, London, New York and Tokyo"},"datePublished":"2026-10-31T13:07:22+00:00","dateModified":"2026-10-31T13:07:22+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#webpage"},"isPartOf":{"@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#webpage"},"articleSection":"Frontend, JavaScript, NodeJS, Date and Time, Frontend Tutorial, JavaScript, Node.js, Temporal API, Time Zones"},{"@type":"BreadcrumbList","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/#listItem","position":1,"name":"Home","item":"https:\/\/devdojo.co.in\/","nextItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/#listItem","name":"Backend"}},{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/#listItem","position":2,"name":"Backend","item":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/","nextItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/#listItem","name":"NodeJS"},"previousItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/#listItem","position":3,"name":"NodeJS","item":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/","nextItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#listItem","name":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right"},"previousItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/#listItem","name":"Backend"}},{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#listItem","position":4,"name":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","previousItem":{"@type":"ListItem","@id":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/#listItem","name":"NodeJS"}}]},{"@type":"Organization","@id":"https:\/\/devdojo.co.in\/#organization","name":"DevDojo","description":"Empowering Developers","url":"https:\/\/devdojo.co.in\/"},{"@type":"Person","@id":"https:\/\/devdojo.co.in\/index.php\/author\/lokendra\/#author","url":"https:\/\/devdojo.co.in\/index.php\/author\/lokendra\/","name":"Lokendra","image":{"@type":"ImageObject","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/99f102f0cc9080237ce54b91304fd1b3b6fa29925cbaeba93cd796872e58b45c?s=96&d=mm&r=g","width":96,"height":96,"caption":"Lokendra"}},{"@type":"WebPage","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#webpage","url":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/","name":"JavaScript Temporal API Tutorial: Dates & Time Zones","description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/devdojo.co.in\/#website"},"breadcrumb":{"@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#breadcrumblist"},"author":{"@id":"https:\/\/devdojo.co.in\/index.php\/author\/lokendra\/#author"},"creator":{"@id":"https:\/\/devdojo.co.in\/index.php\/author\/lokendra\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/devdojo.co.in\/wp-content\/uploads\/2026\/10\/javascript-temporal-api-tutorial.jpg","@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#mainImage","width":1200,"height":630,"caption":"JavaScript Temporal API tutorial banner showing one instant as local times in India, London, New York and Tokyo"},"primaryImageOfPage":{"@id":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/#mainImage"},"datePublished":"2026-10-31T13:07:22+00:00","dateModified":"2026-10-31T13:07:22+00:00"},{"@type":"WebSite","@id":"https:\/\/devdojo.co.in\/#website","url":"https:\/\/devdojo.co.in\/","name":"DevDojo","description":"Empowering Developers","inLanguage":"en-US","publisher":{"@id":"https:\/\/devdojo.co.in\/#organization"}}]},"og:locale":"en_US","og:site_name":"DevDojo - Empowering Developers","og:type":"article","og:title":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","og:description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.","og:url":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/","article:published_time":"2026-10-31T13:07:22+00:00","article:modified_time":"2026-10-31T13:07:22+00:00","twitter:card":"summary_large_image","twitter:title":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","twitter:description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26."},"aioseo_meta_data":{"post_id":"276","title":"JavaScript Temporal API Tutorial: Dates & Time Zones","description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.","keywords":null,"keyphrases":{"focus":{"keyphrase":"JavaScript Temporal API","score":75},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","og_description":"Learn the JavaScript Temporal API with runnable examples: plain dates, time zones, daylight saving, durations and moving from Date to Temporal in Node.js 26.","og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":0,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-10-31 12:59:32","updated":"2026-10-31 13:40:20","focus_keyword":"JavaScript Temporal API","additional_keywords":null,"truseo_locale":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/devdojo.co.in\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/devdojo.co.in\/index.php\/category\/backend\/\" title=\"Backend\">Backend<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/\" title=\"NodeJS\">NodeJS<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tJavaScript Temporal API Tutorial: Dates and Time Zones Done Right\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/devdojo.co.in\/"},{"label":"Backend","link":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/"},{"label":"NodeJS","link":"https:\/\/devdojo.co.in\/index.php\/category\/backend\/nodejs\/"},{"label":"JavaScript Temporal API Tutorial: Dates and Time Zones Done Right","link":"https:\/\/devdojo.co.in\/index.php\/2026\/10\/31\/javascript-temporal-api-tutorial\/"}],"_links":{"self":[{"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":1,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":278,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/posts\/276\/revisions\/278"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/media\/277"}],"wp:attachment":[{"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devdojo.co.in\/index.php\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}