FREE BATTLE πŸ”₯


MOMENT.JS & DAY.JS

Supprt by Adi SanπŸ€–

https://momentjs.com/

Parse, validate, manipulate, and display dates and times in JavaScript.
Format Dates
Format ExpressionOutput
moment().format("MMMM Do YYYY, h:mm:ss a")September 22nd 2025, 6:48:56 am
moment().format("dddd")Monday
moment().format("MMM Do YY")Sep 22nd 25
moment().format("YYYY [escaped] YYYY")2025 escaped 2025
moment().format()2025-09-22T06:48:56+00:00
Relative Time
ExpressionOutput
moment("20111031", "YYYYMMDD").fromNow()14 years ago
moment("20120620", "YYYYMMDD").fromNow()13 years ago
moment().startOf('day').fromNow()7 hours ago
moment().endOf('day').fromNow()in 17 hours
moment().startOf('hour').fromNow()an hour ago
Calendar Time
ExpressionOutput
moment().subtract(10, 'days').calendar()09/12/2025
moment().subtract(6, 'days').calendar()Last Tuesday at 6:48 AM
moment().subtract(3, 'days').calendar()Last Friday at 6:48 AM
moment().subtract(1, 'days').calendar()Yesterday at 6:48 AM
moment().calendar()Today at 6:48 AM
moment().add(1, 'days').calendar()Tomorrow at 6:48 AM
moment().add(3, 'days').calendar()Thursday at 6:48 AM
moment().add(10, 'days').calendar()10/02/2025
Multiple Locale Support
ExpressionOutput
moment.locale()en
moment().format('LT')6:48 AM
moment().format('LTS')6:48:56 AM
moment().format('L')09/22/2025
moment().format('l')9/22/2025
moment().format('LL')September 22, 2025
moment().format('ll')Sep 22, 2025
moment().format('LLL')September 22, 2025 6:48 AM
moment().format('lll')Sep 22, 2025 6:48 AM
moment().format('LLLL')Monday, September 22, 2025 6:48 AM
moment().format('llll')Mon, Sep 22, 2025 6:48 AM

Moment Timezone

Format Dates in Any Timezone
TimezoneJune 1, 2014 (ha z)Dec 1, 2014 (ha z)
America/Los_Angeles5am PDT4am PST
America/New_York8am EDT7am EST
Asia/Tokyo9pm JST9pm JST
Australia/Sydney10pm AEST11pm AEDT
Convert Dates Between Timezones
ExpressionOutput
moment.tz("2014-06-01 12:00", "America/New_York")2014-06-01T12:00:00-04:00
moment.tz("2014-06-01 12:00", "America/Los_Angeles")2014-06-01T09:00:00-07:00
moment.tz("2014-06-01 12:00", "Europe/London")2014-06-01T17:00:00+01:00

https://day.js.org/

Welcome to Fast 2kB alternative to Moment.js with the same modern API

Format Dates
Format ExpressionOutput
dayjs().format("MMMM D YYYY, h:mm:ss A")September 22 2025, 6:48:56 AM
dayjs().format("dddd")Monday
dayjs().format("MMM D YY")Sep 22 25
dayjs().format("YYYY [escaped] YYYY")2025 escaped 2025
dayjs().format()2025-09-22T06:48:56+00:00
Relative Time
ExpressionOutput
dayjs("20111031", "YYYYMMDD").fromNow()14 years ago
dayjs("20120620", "YYYYMMDD").fromNow()13 years ago
dayjs().startOf('day').fromNow()7 hours ago
dayjs().endOf('day').fromNow()in 17 hours
dayjs().startOf('hour').fromNow()an hour ago
Calendar Time
Format ExpressionOutput
dayjs().format("MMMM D YYYY, h:mm:ss A")September 22 2025, 6:48:56 AM
dayjs().format("dddd")Monday
dayjs().format("MMM D YY")Sep 22 25
dayjs().format("YYYY [escaped] YYYY")2025 escaped 2025
dayjs().format()2025-09-22T06:48:56+00:00
today.calendar()Today at 6:48 AM
tomorrow.calendar()Tomorrow at 6:48 AM
today.calendar()9/22/2025
Multiple Locale Support
ExpressionOutput
dayjs.locale()en
dayjs().format('LT')6:48 AM
dayjs().format('LTS')6:48:56 AM
dayjs().format('L')09/22/2025
dayjs().format('l')9/22/2025
dayjs().format('LL')September 22, 2025
dayjs().format('ll')Sep 22, 2025
dayjs().format('LLL')September 22, 2025 6:48 AM
dayjs().format('lll')Sep 22, 2025 6:48 AM
dayjs().format('LLLL')Monday, September 22, 2025 6:48 AM
dayjs().format('llll')Mon, Sep 22, 2025 6:48 AM

Moment Timezone

Format Dates in Any Timezone

TimezoneJune 1, 2014 (ha z)Dec 1, 2014 (ha z)
America/Los_Angeles5AM PDT4AM PST
America/New_York8AM EDT7AM EST
Asia/Tokyo9PM GMT+99PM GMT+9
Australia/Sydney10PM GMT+1011PM GMT+11
Convert Dates Between Timezones
TimezoneFormatted Output
dayjs.tz(baseTime, "America/New_York") 2014-06-01T12:00:00-04:00
dayjs.tz(baseTime, "America/Los_Angeles") 2014-06-01T09:00:00-07:00
dayjs.tz(baseTime, "Europe/London") 2014-06-01T17:00:00+01:00

πŸ•’ Moment.js vs Day.js

Perbandingan antara dua library populer untuk manipulasi tanggal dan waktu di JavaScript: Moment.js dan Day.js.

πŸ“† Moment.js

  • Diciptakan: 15 September 2011
  • Dibuat oleh: Tim Wood
  • Tujuan awal: memberikan API yang mudah digunakan untuk parsing, validasi, manipulasi, dan formatting tanggal.

⚠️ Status Saat Ini

  • Sejak 2020, Moment.js dalam status maintenance mode.
  • Tidak disarankan untuk proyek baru.
  • Referensi: Project Status

πŸ“† Day.js

  • Diciptakan: 23 Mei 2018
  • Dibuat oleh: @iamkun
  • Alternatif ringan dan modern dengan API hampir 100% kompatibel dengan Moment.js

✨ Keunggulan Day.js

  • Ukuran sangat kecil (~2KB tanpa plugin)
  • Cepat dan efisien
  • Immutable (tidak mengubah instance asli)
  • Tree-shaking friendly
  • Mudah diintegrasikan ke Vue, React, Nuxt, dll.

πŸ“Š Perbandingan Singkat

FiturMoment.jsDay.js
Tahun Dirilis20112018
Ukuran Bundle~67 KB~2 KB
PerformaRelatif lambatCepat dan ringan
Tree-shaking❌ Tidak mendukungβœ… Mendukung
Status ProyekLegacyAktif

πŸ”— Bundle size Day.js: bundlephobia.com/package/dayjs

πŸ”— Bundle size Moment.js: bundlephobia.com/package/moment

πŸ“Œ Rekomendasi

  • Untuk proyek baru dan modern: gunakan Day.js
  • Untuk proyek lama: tetap gunakan Moment.js, tapi pertimbangkan migrasi

πŸ”— Referensi