mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 02:22:07 +00:00 
			
		
		
		
	 f6786881aa
			
		
	
	
		f6786881aa
		
	
	
	
	
		
			
			Simply defer to LibTimeZone to retrieve the system's current time zone. Also update some Temporal tests to explicitly set the time zone to UTC.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			981 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			981 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| describe("correct behavior", () => {
 | |
|     test("length is 0", () => {
 | |
|         expect(Temporal.Now.plainTimeISO).toHaveLength(0);
 | |
|     });
 | |
| 
 | |
|     test("basic functionality", () => {
 | |
|         const plainTime = Temporal.Now.plainTimeISO();
 | |
|         expect(plainTime).toBeInstanceOf(Temporal.PlainTime);
 | |
|         expect(plainTime.calendar.id).toBe("iso8601");
 | |
|     });
 | |
| 
 | |
|     test("custom time zone", () => {
 | |
|         const timeZone = {
 | |
|             getOffsetNanosecondsFor() {
 | |
|                 return 86400000000000;
 | |
|             },
 | |
|         };
 | |
|         const plainTime = Temporal.Now.plainTimeISO("UTC");
 | |
|         const plainTimeWithOffset = Temporal.Now.plainTimeISO(timeZone);
 | |
|         // FIXME: Compare these in a sensible way
 | |
|     });
 | |
| });
 | |
| 
 | |
| describe("errors", () => {
 | |
|     test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
 | |
|         expect(() => {
 | |
|             Temporal.Now.plainTimeISO({});
 | |
|         }).toThrowWithMessage(TypeError, "null is not a function");
 | |
|     });
 | |
| });
 |