-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(js-jods): Propert support for date-only and time-only in mergeDat…
…eAndTime method (#653) * Add support for date-only and time-only to js-joda See mui/mui-x#4703 (comment) (although note that mui-x no longer uses date-io) * Simplify code and address code coverage
- Loading branch information
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { LocalDate, LocalTime, LocalDateTime } from '@js-joda/core'; | ||
import JsJodaUtils from "../packages/js-joda/src"; | ||
|
||
describe("js-joda", () => { | ||
const jsJodaUtils = new JsJodaUtils(); | ||
|
||
it("Merges a date with a non-time", () => { | ||
const one = LocalDateTime.of(2022, 12, 5, 9, 30); | ||
const two = LocalDate.of(2022, 12, 6); | ||
|
||
expect(jsJodaUtils.mergeDateAndTime(one, two)).toEqual(one); | ||
}); | ||
|
||
it("Merges a non-date with a time", () => { | ||
const one = LocalTime.of(9, 30); | ||
const two = LocalDateTime.of(2022, 12, 5, 9, 30); | ||
|
||
expect(jsJodaUtils.mergeDateAndTime(one, two)).toEqual(two); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters