WEBVTT

00:00.770 --> 00:03.710
So the date is in.

00:03.740 --> 00:05.810
Again, I click on Select element.

00:05.810 --> 00:07.100
It's on.

00:07.950 --> 00:12.160
It is in the result date class CSS class.

00:12.180 --> 00:14.970
So let's try and select that again.

00:14.970 --> 00:18.120
It is a child of this result info element.

00:19.110 --> 00:20.670
So let's select that.

00:23.950 --> 00:28.390
Const date posted is equal to element.

00:29.860 --> 00:36.880
Find result date and remember to have a dot in front because it's a CSS class.

00:37.540 --> 00:42.010
And then we need to have the attribute of date time.

00:42.580 --> 00:46.690
And I'm going to use that to create a new JavaScript date object.

00:48.070 --> 00:50.050
So date time.

00:51.200 --> 00:55.160
And then I'm going to wrap that around a new date.

00:55.820 --> 00:58.520
So we create a new JavaScript date object.

00:58.910 --> 01:05.360
I prefer to have my my date as a JavaScript date because it simply means that.

01:06.210 --> 01:13.080
I can more easily get things like the month, year and so on, and rather than just having it as a string.

01:15.470 --> 01:16.010
Um.

01:16.010 --> 01:16.370
Okay.

01:16.370 --> 01:21.560
So now I still have the last test is failing.

01:21.830 --> 01:28.730
And the reason why it's a little complicated, but I'll try to explain to you.

01:29.210 --> 01:33.410
So I'm actually getting the same date as I'm writing in here.

01:33.890 --> 01:39.230
The date I have here, it says also received serializes to the same string.

01:39.800 --> 01:46.910
And it says here if it should pass with deep equality, replace to B with two strict equal.

01:47.360 --> 01:54.800
And the reason why it's failing is because there's a different difference between two objects, even

01:54.800 --> 01:57.020
though they have the same properties.

01:57.530 --> 02:05.240
So by that I mean if I say const date one equals new date and I have a date string here.

02:07.300 --> 02:09.070
Could have this date string here.

02:10.700 --> 02:13.340
And if I have one that's called day to.

02:14.360 --> 02:18.440
And I say new date and I have exactly the same date.

02:18.980 --> 02:26.600
If I'm going to test that and put it into a tester and say expect date one to be date two, it's going

02:26.600 --> 02:27.440
to fail.

02:27.770 --> 02:34.640
And the reason why it's going to fail is because in the memory of a compiler or the reference to an

02:34.640 --> 02:36.440
object is not the same.

02:37.030 --> 02:41.440
It's a different place in the memory, this state variable than this one.

02:41.470 --> 02:43.150
They are different.

02:43.780 --> 02:46.570
But they have the same properties, basically.

02:46.570 --> 02:49.480
They're basically twins, so to say.

02:50.200 --> 02:54.610
Um, they are identical but still different.

02:55.360 --> 03:02.500
So the way to get around that is to simply use two strict equal, and that's going to test all of the

03:02.500 --> 03:10.120
properties and make sure that an object has the same properties, even though it's not exactly the same

03:10.120 --> 03:11.110
reference.

03:13.380 --> 03:16.260
And now all of our test is passing.
