<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>187519</bug_id>
          
          <creation_ts>2018-07-10 08:38:46 -0700</creation_ts>
          <short_desc>Date constructor with negative value argument</short_desc>
          <delta_ts>2020-05-20 14:47:22 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gfablima</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ashvayka</cc>
    
    <cc>isol2</cc>
    
    <cc>msaboff</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1440845</commentid>
    <comment_count>0</comment_count>
    <who name="">gfablima</who>
    <bug_when>2018-07-10 08:38:46 -0700</bug_when>
    <thetext>Hi everyone,

I found an inconsistence on Date() with a negative value.
I was looking on ES6 specification about this issue but I didn&apos;t found an answer, maybe the correct way is convert the -0 to +0
as V8 and SpiderMonkey do.

Steps to reproduce:
```
d = new Date(-0);
print(Object.is(d.getTime(), +0))
```

Actual results:
false

Expected results:
true

V8 and SpiderMonkey works as expected.

OS: Ubuntu 16.04 x64
Version: 606.1.9.4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441598</commentid>
    <comment_count>1</comment_count>
    <who name="">isol2</who>
    <bug_when>2018-07-12 11:33:00 -0700</bug_when>
    <thetext>Daily build v233772 not reproduce this issue</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1654651</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2020-05-20 14:47:22 -0700</bug_when>
    <thetext>(In reply to isol2 from comment #1)
&gt; Daily build v233772 not reproduce this issue

r261927 doesn&apos;t reproduce this either.

(In reply to gfablima from comment #0)
&gt; I was looking on ES6 specification about this issue but I didn&apos;t found an
&gt; answer, maybe the correct way is convert the -0 to +0
&gt; as V8 and SpiderMonkey do.

Date constructor (https://tc39.es/ecma262/#sec-date-value) performs TimeClip at step 4.d,
which uses ToInteger (https://tc39.es/ecma262/#sec-tointeger) to normalize -0 to 0 (step 2).

This is covered by:
  https://test262.report/browse/built-ins/Date/TimeClip_negative_zero.js
  https://test262.report/browse/built-ins/Date/prototype/getTime/this-value-valid-date.js
  https://test262.report/browse/built-ins/Date/prototype/valueOf/S9.4_A3_T2.js
(all passed by JSC)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>