Module wikitrek-Stardate
Constants Epoch: Stardate 41000.0 = 1 January 2364 (day 1 of the year)
Class table
| p._toStardate (y, m, d, format) | Convert a date to a formatted stardate string. |
| p._toRealDate (sd, format) | Convert a stardate to a formatted real date string. |
| p.toStardate (frame) | Convert a real date to a TNG-era stardate. |
| p.toRealDate (frame) | Convert a TNG-era stardate to a real date. |
Class table
Days in each month for a common year [1] and a leap year [2].
- p._toStardate (y, m, d, format)
-
Convert a date to a formatted stardate string.
Parameters:
- y Year (number).
- m Month, 1-12 (number).
- d Day of month, 1-31 (number).
- format Output format: "full" for one-decimal stardate, "year" for millennium prefix only (string).
Returns:
-
string Formatted stardate (e.g. "41202.2" or "41000x").
- p._toRealDate (sd, format)
-
Convert a stardate to a formatted real date string.
Parameters:
- sd Stardate value (number), e.g. 41153.7.
- format Output format: "full" for yyyy-mm-dd, "year" for year only (string).
Returns:
-
string Formatted date (e.g. "2364-02-26" or "2364").
- p.toStardate (frame)
-
Convert a real date to a TNG-era stardate.
Reads named parameters from the calling template's frame.
Parameters:
- frame Scribunto frame object (provided automatically by MediaWiki).
Returns:
-
string The computed stardate, or an HTML error span on invalid input.
Usage:
From a wrapper template: <nowiki>{{#invoke:Stardate | toStardate | date=2364-03-15 }}</nowiki> <nowiki>{{#invoke:Stardate | toStardate | date=2364-03-15 | format=year }}</nowiki> - p.toRealDate (frame)
-
Convert a TNG-era stardate to a real date.
Reads named parameters from the calling template's frame.
Parameters:
- frame Scribunto frame object (provided automatically by MediaWiki).
Returns:
-
string The computed date, or an HTML error span on invalid input.
Usage:
From a wrapper template: <nowiki>{{#invoke:Stardate | toRealDate | stardate=41153.7 }}</nowiki> <nowiki>{{#invoke:Stardate | toRealDate | stardate=41153.7 | format=year }}</nowiki>