Convert JavaScript dates to Star Trek: The Next Generation stardates — the same system used by Captain Jean-Luc Picard.
How It Works • Install • Usage • API • Notable Stardates

Captain Jean-Luc Picard — USS Enterprise NCC-1701-D
"Captain's log, stardate 41153.7. Our destination is planet Deneb IV…"
Uses the TNG-era stardate system from the Star Trek Chronology (Okuda & Okuda):
- Stardate 0 = January 1, 2323
- 1000 stardate units = 1 Earth year
- Decimal digit = fractional day (
.0= midnight,.5= noon)
This is the canonical system used across TNG, DS9, Voyager, Lower Decks, and Picard.
| Year | Stardate Range | Series |
|---|---|---|
| 2364 | 41000 – 41999 | TNG Season 1 |
| 2370 | 47000 – 47999 | TNG Season 7 |
| 2375 | 52000 – 52999 | DS9 Season 7 |
| 2378 | 54000 – 54999 | VOY Final Season |
| 2401 | 78000 – 78999 | Picard Season 3 |
Current dates (21st century) produce negative stardates — that's correct! We're ~300 years before the TNG era.
npm install trekdate
# or
pnpm add trekdate
# or
yarn add trekdate
# or
bun add trekdateconst { toStardate, fromStardate, formatStardate, captainsLog } = require('trekdate');Convert a JavaScript Date to a stardate string.
toStardate(new Date('2364-01-01'));
// => "41000.0"
toStardate(new Date('2401-03-08'));
// => "78183.6"
// Current date (2026)
toStardate();
// => "-296751.2" (negative — we're before 2323!)Convert a stardate number back to a JavaScript Date.
fromStardate(41153.7);
// => 2364-02-25T...
fromStardate(47988.0);
// => 2370-12-28T... ("All Good Things..." finale!)Get a formatted TNG-style string.
formatStardate(new Date('2364-10-05'));
// => "Stardate 41756.2"Generate a Captain's Log entry worthy of the Enterprise-D.
captainsLog(new Date('2364-10-05'));
// => "Captain's log, stardate 41756.2."
captainsLog(
new Date('2364-10-05'),
'We have entered the Neutral Zone.'
);
// => "Captain's log, stardate 41756.2. We have entered the Neutral Zone."| Function | Parameters | Returns |
|---|---|---|
toStardate |
date?: Date |
string — e.g. "41153.7" |
fromStardate |
stardate: number |
Date |
formatStardate |
date?: Date |
string — e.g. "Stardate 41153.7" |
captainsLog |
date?: Date, message?: string |
string — e.g. "Captain's log, stardate 41153.7." |
// TNG Pilot: "Encounter at Farpoint"
toStardate(new Date('2364-02-24')); // ~"41148.5"
// First Contact (2373)
toStardate(new Date('2373-11-22')); // ~"50893.2"
// Picard Season 3 (2401)
toStardate(new Date('2401-03-08')); // ~"78183.6"Full type declarations included:
import { toStardate, fromStardate, formatStardate, captainsLog } from 'trekdate';- Star Trek Chronology by Mike & Denise Okuda
- Memory Alpha: Stardate
- Wikipedia: Stardate
MIT — Live long and prosper. 🖖