Skip to content

Commit

Permalink
Date.getTimezoneOffset() now returns float value to support timezones…
Browse files Browse the repository at this point in the history
… with second precision offsets
  • Loading branch information
dop251 committed Nov 25, 2018
1 parent 921ef59 commit 2dd08a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion builtin_date.go
Expand Up @@ -507,7 +507,7 @@ func (r *Runtime) dateproto_getTimezoneOffset(call FunctionCall) Value {
if d, ok := obj.self.(*dateObject); ok {
if d.isSet {
_, offset := d.time.Zone()
return intToValue(int64(-offset / 60))
return floatToValue(float64(-offset) / 60)
} else {
return _NaN
}
Expand Down
16 changes: 7 additions & 9 deletions tc39_test.go
Expand Up @@ -20,13 +20,11 @@ var (

var (
skipList = map[string]bool{
"test/language/literals/regexp/S7.8.5_A1.1_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A1.4_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A2.1_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A2.4_T2.js": true, // UTF-16
"test/built-ins/Date/prototype/toISOString/15.9.5.43-0-9.js": true, // timezone
"test/built-ins/Date/prototype/toISOString/15.9.5.43-0-10.js": true, // timezone
"test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js": true, // property order
"test/language/literals/regexp/S7.8.5_A1.1_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A1.4_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A2.1_T2.js": true, // UTF-16
"test/language/literals/regexp/S7.8.5_A2.4_T2.js": true, // UTF-16
"test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js": true, // property order
}
)

Expand Down Expand Up @@ -95,7 +93,7 @@ func parseTC39File(name string) (*tc39Meta, string, error) {

func runTC39Test(base, name, src string, meta *tc39Meta, t testing.TB, ctx *tc39TestCtx) {
vm := New()
err, early := runTC39Script(base, name, src, meta.Includes, t, ctx, vm)
err, early := runTC39Script(base, name, src, meta.Includes, ctx, vm)

if err != nil {
if meta.Negative.Type == "" {
Expand Down Expand Up @@ -201,7 +199,7 @@ func (ctx *tc39TestCtx) runFile(base, name string, vm *Runtime) error {
return err
}

func runTC39Script(base, name, src string, includes []string, t testing.TB, ctx *tc39TestCtx, vm *Runtime) (err error, early bool) {
func runTC39Script(base, name, src string, includes []string, ctx *tc39TestCtx, vm *Runtime) (err error, early bool) {
early = true
err = ctx.runFile(base, path.Join("harness", "assert.js"), vm)
if err != nil {
Expand Down

0 comments on commit 2dd08a5

Please sign in to comment.