Lodash _.now() method

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 3 Code examples
🚀 3 Try-it labs
Lodash

What you’ll learn

  • What _.now() returns and why it lives under the Date category in Lodash docs.
  • How it relates to Date.now() and when performance.now() is a better fit.
  • A defer-friendly pattern for measuring elapsed milliseconds between scheduling and execution.
  • Try each example in the editor (?tryit=1, 2, 3) with Lodash from a CDN.

Prerequisites

Optional read Lodash Date methods hub; you should be comfortable with plain numbers as timestamps (milliseconds).

  • Unix epoch ms: understanding that Date.now() counts milliseconds since 1970-01-01 UTC.
  • Modules: ability to run import now from "lodash/now" in your bundler or open the Try-it HTML labs.

Overview

_.now() is Lodash’s portable name for the current wall-clock timestamp in epoch milliseconds. It performs no formatting, parsing, or locale work—only a thin wrapper so timers line up with other Lodash imports.

Instant stamp

Drop-in substitute for Date.now() when your module already standardizes on Lodash entry points.

Defer pairing

Lodash examples capture _.now(), schedule work with defer, then subtract inside the callback to measure scheduling delay.

Tree-shakeable

Import lodash/now alone—there is no hidden collection logic bundled behind this helper.

Syntax

javascript
_.now()
  • Arguments: none.
  • Returns: a number—the milliseconds elapsed since the Unix epoch, same family as Date.now().
  • Category: Date in Lodash 4.x documentation.
1

Basic timestamp

Each call samples the host clock; values increase over real time but two ultra-close calls may collide when the clock granularity is coarse.

javascript
import now from "lodash/now";

const stamp = now();
// e.g. 1735689600000 — matches Date.now() on the same tick
Try it Yourself
2

Defer delay (Lodash doc pattern)

Capture a stamp, schedule async-ish work with defer, then subtract inside the callback—classic Lodash documentation wording adapted here.

javascript
import defer from "lodash/defer";
import now from "lodash/now";

defer((stamp) => {
  console.log(now() - stamp);
}, now());
// => Logs milliseconds between scheduling and callback run
Try it Yourself
3

Metadata field

Stamp plain records before persistence or optimistic UI updates—still just a number, ready for JSON.

javascript
import now from "lodash/now";

function createDraft(body) {
  return { body, createdAt: now(), status: "draft" };
}
Try it Yourself

📋 _.now vs Date.now() vs performance.now()

APIReturnsBest for
_.now()Epoch ms (UTC)Consistent Lodash import alongside other per-method imports
Date.now()Epoch ms (UTC)Zero-dep stamps anywhere ECMAScript runs
performance.now()High-res ms since navigation startMonotonic timing deltas in browsers (not JSON timestamps)

Pitfalls to avoid

Collision

Same millisecond twice

High-frequency loops can log identical values; add a counter or UUID when uniqueness matters.

Clock jumps

Wall-clock drift

NTP adjustments can move epoch ms backward—never assume strictly increasing time across reboots or sync events.

Wrong layer

Formatting here

Pass stamps through Intl.DateTimeFormat, Temporal, or libraries when users need readable locale strings.

❓ FAQ

No. Invoke it as _.now() with an empty call list; it always reads the current time from Date.now() inside Lodash 4.x.
Yes numerically: Lodash forwards to the global Date constructor's now method, returning milliseconds since 1970-01-01 UTC.
For short durations in browsers prefer performance.now()—it is monotonic and higher resolution. Use _.now() or Date.now() for wall-clock stamps such as createdAt fields.
Use import now from "lodash/now" and call now(); bundlers can tree-shake the rest of Lodash away.
Yes wherever Date.now exists (modern Node and browsers).

Summary

Did you know?

Lodash implements _.now as root.Date.now(), so the numeric result tracks the native clock—the helper mainly exists for consistency when you already compose other Lodash utilities.

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.

6 people found this page helpful