Hyperlinkv0.8.0-beta.28

SchemaTransformation

SchemaTransformation.timeZoneOffsetFromNumberconsteffect/SchemaTransformation.ts:1715
Transformation<DateTime.TimeZone.Offset, number, never, never>

Decodes a numeric time-zone offset in milliseconds into a DateTime.TimeZone.Offset and encodes it back to the offset number.

When to use

Use when you need a schema transformation to represent fixed-offset time zones with numeric millisecond offsets.

Details

Decode uses DateTime.zoneMakeOffset; encode returns the offset's offset field.

export const timeZoneOffsetFromNumber: Transformation<DateTime.TimeZone.Offset, number> = transform<
  DateTime.TimeZone.Offset,
  number
>({
  decode: (n) => DateTime.zoneMakeOffset(n),
  encode: (tz) => tz.offset
})
Referenced by 1 symbols