Skip to content

Commit

Permalink
use local timezone (#5137) (#9912)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 25, 2021
1 parent 9cffe88 commit a97289f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/5137.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Endpoints: fixed a timezone discrepancy in `config_id` on `google_endpoints_service`
```
7 changes: 1 addition & 6 deletions google/resource_endpoints_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,7 @@ func predictServiceId(_ context.Context, d *schema.ResourceDiff, meta interface{
if !d.HasChange("openapi_config") && !d.HasChange("grpc_config") && !d.HasChange("protoc_output_base64") {
return nil
}
loc, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
// Timezone data may not be present on some machines, in that case skip
return nil
}
baseDate := time.Now().In(loc).Format("2006-01-02")
baseDate := time.Now().Format("2006-01-02")
oldConfigId := d.Get("config_id").(string)
if match, err := regexp.MatchString(`\d\d\d\d-\d\d-\d\dr\d*`, oldConfigId); !match || err != nil {
// If we do not match the expected format, we will guess
Expand Down

0 comments on commit a97289f

Please sign in to comment.