---
title: "Discussion on \"Code Smell 39 - new Date()\" | Hashnode"
description: "Discussion on \"Code Smell 39 - new Date()\". 70s first tutorial: getCurrentDate(). Piece of Cake. We are in the 20s Time is global no more\nProblems\n\nCoupling\n\nFragile Tests\n\nTimezone Problems\n\n\nSolutions\n\nUse Dependency injection to decouple time source.\n\nSample Code\nWrong\nvar today = new Date(..."
url: "https://hashnode.com/posts/code-smell-39-new-date/5fc5ce7cbc24037614dfa08b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Code Smell 39 - new Date()](https://maximilianocontieri.com/code-smell-39-new-date?utm_source=hashnode&utm_medium=feed)

70s first tutorial: getCurrentDate(). Piece of Cake. We are in the 20s Time is global no more Problems Coupling Fragile Tests Timezone Problems Solutions Use Dependency injection to decouple time source. Sample Code Wrong var today = new Date(...

Dec 1, 2020 · 2 min read · maximilianocontieri.com  
Updated May 31, 2022  
Read the article

-   [#programming](https://hashnode.com/tag/programming)
-   [#code-smell-1](https://hashnode.com/tag/code-smell-1)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Maxi Contieri](https://hashnode.com/@mcsee)

@mcsee · Buenos Aires

  
[View profile](https://hashnode.com/@mcsee)

Software Engineer

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
