<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe" -->

---
title: Let&#x27;s keep it green ✅ | daily.dev
description: A consultant shares a practical refactoring story: replacing Moment.js with Day.js to reduce bundle size. The approach involves three steps — centralizing...
canonical: https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Let&#x27;s keep it green ✅ | daily.dev
og:description: A consultant shares a practical refactoring story: replacing Moment.js with Day.js to reduce bundle size. The approach involves three steps — centralizing...
og:url: https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe
og:image: https://api.daily.dev/og/posts/yrD5hQXhE.png
og:image:alt: Let&#x27;s keep it green ✅
og:image:width: 1200
og:image:height: 630
og:locale: en
---

[Playful Programming](https://daily.dev/sources/playfulprogramming)

[Read post](https://api.daily.dev/r/yrD5hQXhE)

# [Let's keep it green ✅](https://api.daily.dev/r/yrD5hQXhE "Go to post")

This title could be clearer and more informative. Try out Clickbait Shield for free (5 uses left this month).

A consultant shares a practical refactoring story: replacing Moment.js with Day.js to reduce bundle size. The approach involves three steps — centralizing library calls, writing tests to cover existing behavior, then swapping the library. The post emphasizes that a solid test suite is the foundation of safe refactoring, and demonstrates the bundle size improvement using rollup-plugin-visualizer.

[#testing](/tags/testing "Check all #testing posts")

Mar 16 • 2m read time • From [playfulprogramming.com](https://api.daily.dev/r/yrD5hQXhE "playfulprogramming.com")

[![Post cover image](https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4c061667de9ad02975ab9020d11a4810?_a=AQAEuop)](https://api.daily.dev/r/yrD5hQXhE "Go to post")

Table of contents

[Refactoring Copy link Link copied!](https://api.daily.dev/r/yrD5hQXhE?a=Refactoring "Refactoring Copy link Link copied!")[ Testing Copy link Link copied!](https://api.daily.dev/r/yrD5hQXhE?a=Testing "Testing Copy link Link copied!")[ A real example Copy link Link copied!](https://api.daily.dev/r/yrD5hQXhE?a=A-real-example "A real example Copy link Link copied!")[ Results 🚀 Copy link Link copied!](https://api.daily.dev/r/yrD5hQXhE?a=Results- "Results 🚀 Copy link Link copied!")

Comment

Bookmark

Copy

![Placeholder image for anonymous user](https://media.daily.dev/image/upload/s--qsFuKGv_--/t_logo,f_auto/public/noProfile)Share your thoughts Post

Share this post

[![Playful Programming's image](https://media.daily.dev/image/upload/s--WoGOmY81--/f_auto,q_auto/v1773697582/logos/playfulprogramming?_a=BAMAMiiu0)](https://daily.dev/sources/playfulprogramming)

[Playful Programming](https://daily.dev/sources/playfulprogramming "https://daily.dev/sources/playfulprogramming")

7 Followers

•

34 Upvotes

#### Would you recommend this post?

Copy link

Slack

WhatsApp

Facebook

X

New Squad

Copy linkShare with your friends

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Let's keep it green ✅","url":"https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe"},"datePublished":"2026-03-16T21:47:19.186Z","dateModified":"2026-03-16T21:58:17.563Z","description":"A consultant shares a practical refactoring story: replacing Moment.js with Day.js to reduce bundle size. The approach involves three steps — centralizing...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4c061667de9ad02975ab9020d11a4810?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4c061667de9ad02975ab9020d11a4810?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Playful Programming","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Playful Programming","logo":"https://media.daily.dev/image/upload/s--WoGOmY81--/f_auto,q_auto/v1773697582/logos/playfulprogramming?_a=BAMAMiiu0","url":"https://daily.dev/sources/playfulprogramming"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/let-s-keep-it-green--yrd5hqxhe","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Playful Programming","item":"https://daily.dev/sources/playfulprogramming"},{"@type":"ListItem","position":3,"name":"Let's keep it green ✅"}]}
```

