-
Notifications
You must be signed in to change notification settings - Fork 75
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
Support for google.protobuf.Timestamp as string #1015
Comments
Fields that use a Timestamp message always use a Timestamp message in generated code. There are a few functions for conversion, see /~https://github.com/bufbuild/protobuf-es/blob/v2.2.2/MANUAL.md#googleprotobuftimestamp You can also use import { fromJson, toJson } from "@bufbuild/protobuf";
import { timestampNow, TimestampSchema } from "@bufbuild/protobuf/wkt";
const str = toJson(TimestampSchema, timestampNow());
const ts = fromJson(TimestampSchema, str);
console.log(str, ts); |
Yes, I know, but it will not be comfortable for our clients that use our SDK. |
Is that because of backwards compatibility? I'm not sure that a string is a great representation for end users. Won't they have to parse the strings to make use of them? We'd love to use |
Currently it returns:
Migrating from ts-proto that supports useDate string:
How can we do this using this library?
The text was updated successfully, but these errors were encountered: