Skip to content

Commit

Permalink
Describe why DateMillisecond is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Apr 2, 2024
1 parent 45a8a87 commit 82b3053
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,20 @@ export class Date_<T extends Dates = Dates> extends DataType<T> {

/** @ignore */
export class DateDay extends Date_<Type.DateDay> { constructor() { super(DateUnit.DAY); } }
/** @ignore */
/**
* A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01) in milliseconds.
* According to the specification (see [Schema.fbs]), this should be treated as the number of days, in milliseconds,
* since the UNIX epoch. Therefore, values must be evenly divisible by `86_400_000` (the number of milliseconds in a
* standard day).
*
* Practically, validation that values of this type are evenly divisible by `86_400_000` is not enforced by this library
* for performance and usability reasons.
*
* Users should prefer to use {@link DateDay} to cleanly represent the number of days. For JS dates,
* {@link TimestampMillisecond} is the preferred type.
*
* @ignore
*/
export class DateMillisecond extends Date_<Type.DateMillisecond> { constructor() { super(DateUnit.MILLISECOND); } }

/** @ignore */
Expand Down

0 comments on commit 82b3053

Please sign in to comment.