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
Allow for predefined "constants" in time formatting built-ins #5945
Comments
@ashutosh-narkar I'd like to take a crack at this if that's okay? |
Of course @tjons 👍 I think we should go with just string literals as we aren't using constants anywhere else in the "stdlib". |
Hi @anderseknert which package/files should I look into for this. I just want to explore. I won't do anything as @tjons is already on it. |
@anderseknert I tried to look in this code. I guess builtinFormat function in time.go file needs to be changed. right ? |
Yep, looks about right to me 👍 |
Opened #6005 to add this! |
The golang time formatting "reference date" is... questionable, and sadly something we've inherited in OPA. To make things at least somewhat bearable, it would be great if we could support the predefined constants for common datetime formats as supported by Go, like RFC1123 (and others). We don't really have constants in Rego exposed like we have built-in functions, but I guess it would be possible to provide something like that.
If not:
Perhaps we could just allow the string value, like:
Applies to
time.format
andtime.parse_ns
.Issue created from disucssion with @JinXiu2023
The text was updated successfully, but these errors were encountered: