You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Yes, the value for daylight savings is a number stored as a string, not a boolean.
I would like to be able to use the existing Timezone class as part of the Account class that represents the data shown above, something like this:
classAccountextendsData
{
#[Computed]
publicstring$dst;
publicfunction__construct(
public readonly string$account,
public readonly string$name,
public readonly string$address,
public readonly Timezone$timeZone,
)
{}
}
I read through the documentation, but I don't really see a good way to map two JSON values into a single property (for incoming data) and map that property back into two JSON values (for outgoing data).
Is there a way I can do this easily, or am I stuck keeping the Timezone data as two separate properties in the Account class?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an API provided to me that represents US/Canada timezones as an object like this:
The problem is that in some parts of the API, the timezone information isn't actually a separate object, it is part of a larger object, like this:
(Yes, the value for daylight savings is a number stored as a string, not a boolean.
I would like to be able to use the existing
Timezone
class as part of theAccount
class that represents the data shown above, something like this:I read through the documentation, but I don't really see a good way to map two JSON values into a single property (for incoming data) and map that property back into two JSON values (for outgoing data).
Is there a way I can do this easily, or am I stuck keeping the
Timezone
data as two separate properties in theAccount
class?Beta Was this translation helpful? Give feedback.
All reactions