Lodash Date methods

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 2 Code examples
Lodash

What you’ll learn

  • What to know before you start (see Prerequisites).
  • Why Lodash’s Date category is almost entirely about Unix millisecond timestamps.
  • How _.now() compares to Date.now() and performance.now().
  • Where to look outside Lodash for formatting, parsing, and time zones.
  • Where this hub sits in the Lodash docs taxonomy and how imports stay tree-shakeable.

Prerequisites

Numbers in JavaScript, optional familiarity with Lodash collection tutorials, and realistic expectations: Lodash is not Moment.js.

  • Unix milliseconds: timestamps from Date.now() count milliseconds since 1970-01-01 UTC; they are numeric, easy to sort, and safe for JSON.
  • The Date object: constructing new Date(), reading components in local time versus UTC, and knowing that invalid parses yield Invalid Date.
  • Modules: ESM import or CommonJS require so the snippets below match your bundler or Node project.

Key concepts

Three distinctions keep Date-adjacent code readable: what you are measuring, what clock backs it, and whether Lodash is involved at all.

Instant vs presentation

A single instant can be stored as ms since epoch. Turning it into “May 10, 2026 in Tokyo” is formatting—reach for Intl, Temporal, or a date library, not Lodash.

Wall clock vs monotonic

Date.now() and _.now() follow the system clock and can jump backward after adjustments. performance.now() in browsers is better for durations between two moments in one session.

Lodash’s narrow role

Lodash dates the category as “Date” in docs but ships one portable helper for current epoch ms. Everything richer stays in the language or ecosystem.

Overview

Use Lodash here when you already import the library and want a tiny, tree-shakeable alias for “right now in epoch milliseconds.” For locale-aware strings or recurring calendar rules, plan on native APIs or specialized packages.

IDs and ordering

Epoch ms works well for createdAt fields, rough versioning, and lexicographic sorts when converted to fixed-width strings.

Defer and throttle patterns

Lodash’s own examples pair _.now() with defer or timing utilities to measure elapsed ms—still about timestamps, not calendars.

Know the gaps

Parsing user-typed dates, DST edges, and recurring events need dedicated tooling; pretending Lodash covers them leads to subtle bugs.

⚖️ _.now vs native clocks

Pick the API that matches whether you need an absolute timestamp, a monotonic interval, or rich formatting.

GoalTypical choiceNotes
Persist “when this happened” as a numberDate.now() or _.now()Same numeric meaning in Lodash 4.x; both are UTC epoch ms.
Measure how long a hot path takesperformance.now() (where available)Monotonic; not interchangeable with epoch timestamps.
Display a localized date stringIntl.DateTimeFormat or TemporalLodash does not replace these layers.
Parse arbitrary user text safelyStrict parsers (libraries or Temporal)Avoid relying on Date.parse alone for untrusted input.
1

Install and import

Install the core package once, then import now directly so unused Lodash stays out of your bundle.

Terminal
npm install lodash
javascript
import now from "lodash/now";

const startedAt = now();
// same epoch-ms family as Date.now()

requestIdleCallback?.(() => {
  console.log(now() - startedAt);
});

Suggested learning path

Lodash date coverage is intentionally small—pair it with platform APIs in this order.

  1. Timestamps: practice storing and comparing raw ms values alongside Date.now() on MDN.
  2. Display: format a fixed instant with Intl.DateTimeFormat so locale behavior is explicit.
  3. Durations: in browsers, contrast with performance.now() for micro-benchmarks.
  4. Ecosystem: reach for Temporal or a maintained date library when rules outgrow one-off formatting.

💻 Environment and versions

  • Lodash 4.x: _.now is stable across environments that provide Date.now (modern browsers and Node).
  • Isomorphic code: both Date.now() and lodash/now behave the same when the global Date object is standard.
  • TypeScript: typings ship with @types/lodash for namespace imports; per-method imports still benefit from those declarations.

Method index

Lodash lists one Date-category helper in 4.x in stable releases. Each row links to a focused tutorial on this site where available; URLs follow /lodash/date/{method-kebab}.

MethodWhat it does
_.now()Returns the current time as milliseconds since the Unix epoch (delegates to Date.now()).

Pitfalls to avoid

Clock skew

Trusting ms for strict ordering

Two calls in tight loops can yield identical timestamps; use counters or UUIDs when collisions matter.

Wrong tool

Formatting with Lodash

String templates around new Date() without Intl quickly break for locales; plan formatting explicitly.

Parsing

Implicit Date parsing

Feeding ambiguous strings into new Date(...) yields inconsistent results across engines—validate input.

❓ FAQ

Lodash 4.x does not bundle parsers, formatters, or time-zone helpers. Use the native Date object, Intl.DateTimeFormat, Temporal where available, or a dedicated library when you need human-readable strings or zones.
Yes in practice: Lodash delegates to Date.now(), returning milliseconds since the Unix epoch in UTC. Choose whichever reads clearer in your module—both are common for IDs and performance sketches.
For measuring short intervals or animation frames in browsers, performance.now() is monotonic and higher resolution. _.now() and Date.now() are wall-clock timestamps, better for logging createdAt-style values.
Prefer import now from 'lodash/now' (or tree-shakeable paths) so bundles stay minimal when you only need the helper.

Summary

  • Scope: Lodash Date here means portable epoch-ms via _.now(); calendars live elsewhere.
  • Bundles: import lodash/now when that is all you need.
  • Next step: bookmark Lodash _.now(), revisit Lodash Collection Methods, or follow the learning-path links above.
Did you know?

Under the hood, Lodash _.now() calls Date.now() on the global object—so numeric results match the native API; Lodash mainly gives you a consistent import surface inside larger chains.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful