mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibJS: Use correct epoch offset in InterpretISODateTimeOffset
This commit is contained in:
parent
9face18ab2
commit
7aee254708
Notes:
github-actions[bot]
2024-11-26 20:15:20 +00:00
Author: https://github.com/trflynn89
Commit: 7aee254708
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2596
Reviewed-by: https://github.com/gmta ✅
2 changed files with 11 additions and 1 deletions
|
@ -114,7 +114,7 @@ ThrowCompletionOr<Crypto::SignedBigInteger> interpret_iso_date_time_offset(VM& v
|
||||||
auto rounded_candidate_nanoseconds = round_number_to_increment(candidate_offset, NANOSECONDS_PER_MINUTE, RoundingMode::HalfExpand);
|
auto rounded_candidate_nanoseconds = round_number_to_increment(candidate_offset, NANOSECONDS_PER_MINUTE, RoundingMode::HalfExpand);
|
||||||
|
|
||||||
// ii. If roundedCandidateNanoseconds = offsetNanoseconds, then
|
// ii. If roundedCandidateNanoseconds = offsetNanoseconds, then
|
||||||
if (candidate_offset.compare_to_double(offset_nanoseconds) == Crypto::UnsignedBigInteger::CompareResult::DoubleEqualsBigInt) {
|
if (rounded_candidate_nanoseconds.compare_to_double(offset_nanoseconds) == Crypto::UnsignedBigInteger::CompareResult::DoubleEqualsBigInt) {
|
||||||
// 1. Return candidate.
|
// 1. Return candidate.
|
||||||
return move(candidate);
|
return move(candidate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,16 @@ describe("correct behavior", () => {
|
||||||
expect(result).toBe(1);
|
expect(result).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("match minutes", () => {
|
||||||
|
const duration = new Temporal.Duration(1, 0, 0, 0, 24);
|
||||||
|
|
||||||
|
const result = duration.total({
|
||||||
|
unit: "days",
|
||||||
|
relativeTo: "1970-01-01T00:00:00-00:45[Africa/Monrovia]",
|
||||||
|
});
|
||||||
|
expect(result).toBe(366);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("errors", () => {
|
describe("errors", () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue