-
Notifications
You must be signed in to change notification settings - Fork 1
StdLib Date
Roger Johansson edited this page Jan 14, 2026
·
1 revision
The Date built-in provides methods for working with dates and times.
Implementation Status: 100% Complete
| Category | Methods | Implemented |
|---|---|---|
| Static Methods | 3 | 3 |
| Getters (Local) | 11 | 11 |
| Getters (UTC) | 8 | 8 |
| Setters (Local) | 9 | 9 |
| Setters (UTC) | 7 | 7 |
| Conversion/Formatting | 12 | 12 |
| Total | 50 | 50 |
| Method | Status | Description |
|---|---|---|
Date.now() |
Implemented | Returns current UTC timestamp (ms) |
Date.parse(dateString) |
Implemented | Parses date string to timestamp |
Date.UTC(year, month, ...) |
Implemented | Returns UTC timestamp from components |
new Date() // Current date/time
new Date(timestamp) // From milliseconds since epoch
new Date(dateString) // From string
new Date(year, month, ...) // From components (month is 0-indexed)| Method | Status | Description |
|---|---|---|
getTime() |
Implemented | Returns timestamp (ms) |
getFullYear() |
Implemented | Returns 4-digit year |
getMonth() |
Implemented | Returns month (0-11) |
getDate() |
Implemented | Returns day of month (1-31) |
getDay() |
Implemented | Returns day of week (0-6) |
getHours() |
Implemented | Returns hours (0-23) |
getMinutes() |
Implemented | Returns minutes (0-59) |
getSeconds() |
Implemented | Returns seconds (0-59) |
getMilliseconds() |
Implemented | Returns milliseconds (0-999) |
getTimezoneOffset() |
Implemented | Returns offset in minutes |
getYear() |
Implemented | Returns year - 1900 (deprecated) |
| Method | Status | Description |
|---|---|---|
getUTCFullYear() |
Implemented | Returns UTC year |
getUTCMonth() |
Implemented | Returns UTC month (0-11) |
getUTCDate() |
Implemented | Returns UTC day of month |
getUTCDay() |
Implemented | Returns UTC day of week |
getUTCHours() |
Implemented | Returns UTC hours |
getUTCMinutes() |
Implemented | Returns UTC minutes |
getUTCSeconds() |
Implemented | Returns UTC seconds |
getUTCMilliseconds() |
Implemented | Returns UTC milliseconds |
| Method | Status | Description |
|---|---|---|
setTime(timestamp) |
Implemented | Sets timestamp directly |
setMilliseconds(ms) |
Implemented | Sets milliseconds |
setSeconds(sec, ms?) |
Implemented | Sets seconds (and optionally ms) |
setMinutes(min, sec?, ms?) |
Implemented | Sets minutes |
setHours(hour, min?, sec?, ms?) |
Implemented | Sets hours |
setDate(day) |
Implemented | Sets day of month |
setMonth(month, day?) |
Implemented | Sets month |
setFullYear(year, month?, day?) |
Implemented | Sets year |
setYear(year) |
Implemented | Sets year - 1900 (deprecated) |
| Method | Status | Description |
|---|---|---|
setUTCMilliseconds(ms) |
Implemented | Sets UTC milliseconds |
setUTCSeconds(sec, ms?) |
Implemented | Sets UTC seconds |
setUTCMinutes(min, sec?, ms?) |
Implemented | Sets UTC minutes |
setUTCHours(hour, min?, sec?, ms?) |
Implemented | Sets UTC hours |
setUTCDate(day) |
Implemented | Sets UTC day of month |
setUTCMonth(month, day?) |
Implemented | Sets UTC month |
setUTCFullYear(year, month?, day?) |
Implemented | Sets UTC year |
| Method | Status | Description |
|---|---|---|
toString() |
Implemented | Full date string with timezone |
toDateString() |
Implemented | Date portion only |
toTimeString() |
Implemented | Time portion only |
toISOString() |
Implemented | ISO 8601 format |
toJSON() |
Implemented | ISO string or null for invalid |
toUTCString() |
Implemented | UTC formatted string |
toGMTString() |
Implemented | Alias for toUTCString() |
valueOf() |
Implemented | Returns timestamp |
toLocaleString() |
Implemented | Locale-aware date+time |
toLocaleDateString() |
Implemented | Locale-aware date only |
toLocaleTimeString() |
Implemented | Locale-aware time only |
[Symbol.toPrimitive](hint) |
Implemented | Conversion with hint |
| Method | Status | Description |
|---|---|---|
toTemporalInstant() |
Implemented | Converts to Temporal.Instant |
The timezone can be configured via RealmState.Options.TimeZone.
Invalid dates return NaN for numeric methods and "Invalid Date" for string methods.
- Years 0-99 in constructor are interpreted as 1900-1999
-
Date.UTC()treats 0-99 as 1900-1999 - Full year values work normally outside this range
Locale methods (toLocaleString, etc.) use Intl.DateTimeFormat internally.
| File | Purpose |
|---|---|
StdLib/Date/DateConstructor.cs |
Constructor and static methods |
StdLib/Date/DatePrototype.cs |
Prototype methods |
StdLib/Date/DateHelper.cs |
Internal calculations |
- Temporal-API - Modern date/time API
- StdLib-Intl - Internationalization