LibJS: Implement Temporal.PlainYearMonth.prototype.until/since

This commit is contained in:
Timothy Flynn 2024-11-21 13:21:29 -05:00 committed by Andreas Kling
commit cb5d1b5086
Notes: github-actions[bot] 2024-11-22 18:56:30 +00:00
26 changed files with 1586 additions and 1 deletions

View file

@ -34,4 +34,17 @@ Crypto::UnsignedBigInteger const SECONDS_PER_MINUTE = 60_bigint;
Crypto::UnsignedBigInteger const MINUTES_PER_HOUR = 60_bigint;
Crypto::UnsignedBigInteger const HOURS_PER_DAY = 24_bigint;
// 8.5.1 IsValidEpochNanoseconds ( epochNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal-isvalidepochnanoseconds
bool is_valid_epoch_nanoseconds(Crypto::SignedBigInteger const& epoch_nanoseconds)
{
// 1. If (epochNanoseconds) < nsMinInstant or (epochNanoseconds) > nsMaxInstant, then
if (epoch_nanoseconds < NANOSECONDS_MIN_INSTANT || epoch_nanoseconds > NANOSECONDS_MAX_INSTANT) {
// a. Return false.
return false;
}
// 2. Return true.
return true;
}
}