mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:12:43 +00:00 
			
		
		
		
	 cfb77b66e5
			
		
	
	
		cfb77b66e5
		
	
	
	
	
		
			
			This commit adds the ZonedDateTime object itself, its constructor and prototype (currently empty), and the CreateTemporalZonedDateTime abstract operation.
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibJS/Runtime/BigInt.h>
 | |
| #include <LibJS/Runtime/Object.h>
 | |
| 
 | |
| namespace JS::Temporal {
 | |
| 
 | |
| class ZonedDateTime final : public Object {
 | |
|     JS_OBJECT(ZonedDateTime, Object);
 | |
| 
 | |
| public:
 | |
|     ZonedDateTime(BigInt& nanoseconds, Object& time_zone, Object& calendar, Object& prototype);
 | |
|     virtual ~ZonedDateTime() override = default;
 | |
| 
 | |
|     BigInt const& nanoseconds() const { return m_nanoseconds; }
 | |
|     BigInt& nanoseconds() { return m_nanoseconds; }
 | |
|     Object const& time_zone() const { return m_time_zone; }
 | |
|     Object& time_zone() { return m_time_zone; }
 | |
|     Object const& calendar() const { return m_calendar; }
 | |
|     Object& calendar() { return m_calendar; }
 | |
| 
 | |
| private:
 | |
|     virtual void visit_edges(Visitor&) override;
 | |
| 
 | |
|     // 6.4 Properties of Temporal.ZonedDateTime Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-zoneddatetime-instances
 | |
|     BigInt& m_nanoseconds; // [[Nanoseconds]]
 | |
|     Object& m_time_zone;   // [[TimeZone]]
 | |
|     Object& m_calendar;    // [[Calendar]]
 | |
| };
 | |
| 
 | |
| ZonedDateTime* create_temporal_zoned_date_time(GlobalObject&, BigInt& epoch_nanoseconds, Object& time_zone, Object& calendar, FunctionObject* new_target = nullptr);
 | |
| 
 | |
| }
 |