Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] String TimeZone validation #249

Open
dropwhile opened this issue Sep 4, 2024 · 0 comments
Open

[Feature Request] String TimeZone validation #249

dropwhile opened this issue Sep 4, 2024 · 0 comments
Labels
Feature New feature or request Good First Issue Good issues for first-time contributors

Comments

@dropwhile
Copy link

dropwhile commented Sep 4, 2024

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];
@dropwhile dropwhile added the Feature New feature or request label Sep 4, 2024
@dropwhile dropwhile changed the title [Feature Request] Timezone validation [Feature Request] String TimeZone validation Sep 4, 2024
@rodaine rodaine added the Good First Issue Good issues for first-time contributors label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Good First Issue Good issues for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants