You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bake/hclparser/stdlib.go
+50-3Lines changed: 50 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package hclparser
2
2
3
3
import (
4
4
"errors"
5
+
"math/big"
5
6
"os"
6
7
"os/user"
7
8
"path"
@@ -63,7 +64,8 @@ var stdlibFunctions = []funcDef{
63
64
{name: "flatten", fn: stdlib.FlattenFunc},
64
65
{name: "floor", fn: stdlib.FloorFunc},
65
66
{name: "format", fn: stdlib.FormatFunc},
66
-
{name: "formatdate", fn: stdlib.FormatDateFunc},
67
+
{name: "formatdate", fn: stdlib.FormatDateFunc, descriptionAlt: `Deprecated: use formattimestamp instead. Formats a timestamp given in RFC 3339 syntax into another timestamp in some other machine-oriented time syntax, as described in the format string.`},
// formatTimestampFunc constructs a function that formats either an RFC3339
285
+
// timestamp string or a unix timestamp integer using the same format verbs as
286
+
// formatdate.
287
+
funcformatTimestampFunc() function.Function {
288
+
returnfunction.New(&function.Spec{
289
+
Description: `Formats a timestamp string in RFC 3339 syntax or a unix timestamp integer into another timestamp in some other machine-oriented time syntax, as described in the format string.`,
Copy file name to clipboardExpand all lines: docs/bake-stdlib.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,9 @@ title: Bake standard library functions
38
38
|[`flatten`](#flatten)| Transforms a list, set, or tuple value into a tuple by replacing any given elements that are themselves sequences with a flattened tuple of all of the nested elements concatenated together. |
39
39
|[`floor`](#floor)| Returns the greatest whole number that is less than or equal to the given value. |
40
40
|[`format`](#format)| Constructs a string by applying formatting verbs to a series of arguments, using a similar syntax to the C function \"printf\". |
41
-
|[`formatdate`](#formatdate)| Formats a timestamp given in RFC 3339 syntax into another timestamp in some other machine-oriented time syntax, as described in the format string.|
41
+
|[`formatdate`](#formatdate)|Deprecated: use formattimestamp instead. Formats a timestamp given in RFC 3339 syntax into another timestamp in some other machine-oriented time syntax, as described in the format string. |
42
42
|[`formatlist`](#formatlist)| Constructs a list of strings by applying formatting verbs to a series of arguments, using a similar syntax to the C function \"printf\". |
43
+
|[`formattimestamp`](#formattimestamp)| Formats a timestamp string in RFC 3339 syntax or a unix timestamp integer into another timestamp in some other machine-oriented time syntax, as described in the format string. |
43
44
|[`greaterthan`](#greaterthan)| Returns true if and only if the second number is greater than the first. |
44
45
|[`greaterthanorequalto`](#greaterthanorequalto)| Returns true if and only if the second number is greater than or equal to the first. |
45
46
|[`hasindex`](#hasindex)| Returns true if if the given collection can be indexed with the given key without producing an error, or false otherwise. |
@@ -533,6 +534,10 @@ target "webapp-dev" {
533
534
534
535
## `formatdate`
535
536
537
+
> [!WARNING]
538
+
> Deprecated: use `formattimestamp` instead. `formatdate` only accepts RFC3339
539
+
> timestamp strings.
540
+
536
541
```hcl
537
542
# docker-bake.hcl
538
543
target "webapp-dev" {
@@ -544,6 +549,28 @@ target "webapp-dev" {
544
549
}
545
550
```
546
551
552
+
## `formattimestamp`
553
+
554
+
Formats either an RFC3339 timestamp string or a unix timestamp integer.
0 commit comments