Skip to content

[Feature Request] String TimeZone validation #249

@dropwhile

Description

@dropwhile

Feature description:
Since google.protobuf.TimeStamp is just seconds and nanos in UTC, a somewhat common solution to a lack of timezone information is to simply send a timezone along with it. Sending a numerical offset is sometimes fragile as offsets can change due to daylight savings or tz updates, so a tz string may be sent along with a timestamp instead.

It would be nice to have a means to validate that the timezone is valid, as per the cel timezone supported formats (eg. TimeZone = "UTC" | LongTZ , as I don't think FixedTZ makes as much sense in this context)

Problem it solves or use case:
Consider the following proto:

syntax = "proto3";
package some.thing.v1;

import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";

message TimestampTZ {
  google.protobuf.Timestamp ts = 1;
  string tz = 2;
}

It would be nice to have something like:

  string tz = 2 [(buf.validate.field).string.timezone = true];

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions