<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Dto on Pasi Dev</title><link>https://dev.pasi.pl/tags/dto/</link><description>Recent content in Dto on Pasi Dev</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 07 Oct 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://dev.pasi.pl/tags/dto/index.xml" rel="self" type="application/rss+xml"/><item><title>Rethinking Date Handling in DTOs: Why Strings Make More Sense in NodeJS</title><link>https://dev.pasi.pl/rethinking-date-handling-in-dtos-why-strings-make-more-sense-in-nodejs/</link><pubDate>Tue, 07 Oct 2025 00:00:00 +0000</pubDate><guid>https://dev.pasi.pl/rethinking-date-handling-in-dtos-why-strings-make-more-sense-in-nodejs/</guid><description>&lt;p&gt;Data Transfer Objects (DTOs) are the contracts between client and the server. They need to be &lt;strong&gt;simple&lt;/strong&gt;, &lt;strong&gt;serializable&lt;/strong&gt;, and &lt;strong&gt;explicit&lt;/strong&gt;. Yet over the years NodeJS developers casually drop JavaScript &lt;code&gt;Date&lt;/code&gt; objects into DTOs—thinking it&amp;rsquo;s harmless and convenient.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not.&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;Date&lt;/code&gt; in DTOs introduces subtle bugs, timezone inconsistencies, test fragility, and serialization mismatches. It also violates the basic principle of DTO design: &lt;strong&gt;no hidden behavior&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s why you should stick to ISO 8601 strings instead—and what can go wrong if you don&amp;rsquo;t.&lt;/p&gt;</description></item></channel></rss>