forked from tc39/proposal-temporal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
July2018Updates.html
140 lines (99 loc) · 3.58 KB
/
July2018Updates.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# Temporal Updates
## July 2018
---
# Open Items
1. toString and String Parsing
2. Plus
3. .valueOf() and comparisons
4. Min and Max Value
5. ZonedInstant vs DateTime
6. Controversies
---
# toString and String Parsing
Objects parse their `.toString()` output in their `.fromString()` method.
```js
new Temporal.CivilDate(2018,02,25).toString() // 2018-02-25
new Temporal.CivilTime(16, 22, 25).toString() // 16:22.250000000
new Temporal.CivilDateTime(2018,2,25,16,22,25).toString() // 2018-02-25T16:22.250000000
new Temporal.Instant(1532527682290).toString() // 2018-07-25T14:08:02.290000000Z
let instant = new Temporal.Instant(2018-07-25T14:08:02.290Z)
new Temporal.ZonedInstant(instant, 'America/Los_Angeles').toString()
// 2018-07-25T07:08:02.290000000[America/Los_Angeles]
```
---
# Plus
<a href="https://github.com/tc39/proposal-temporal/issues/58" >GitHub Issue</a>
The plus function takes an object with the desired units and applies them in descending order of size:
```js
let myCivilDate = new Temporal.CivilDate(2016, 2, 29);
let newCivilDate = myCivilDate.plus({years: 1, months: 2});
```
Should this result in 2017-04-28 or 2017-04-29?
Should instant types support calendar computations?
---
# `.valueOf()` and comparisons
<a href="https://github.com/tc39/proposal-temporal/issues/25">ValueOf Issue</a>
<br />
<a href="https://github.com/tc39/proposal-temporal/issues/35">Comparisons Issue</a>
<br/>
<a href="https://github.com/tc39/proposal-temporal/issues/67">Internal epoch issue</a>
The `.valueOf()` for CivilDate is the integer value of days since 1970-01-01.
The `.valueOf()` for CivilTime is the integer value of nanoseconds since 00:00.
The `.valueOf()` for CivilDateTime is the integer value of nanoseconds since 1970-01-01T00:00.000000000.
The `.valueOf()` for Instant is the integer value of nanoseconds since 1970-01-01T00:00.000000000Z.
Is this sufficent for sorting support?
---
# ZonedInstant `.valueOf()` and Comparisons
```js
let instant = new Temporal.Instant(1532527682290);
let sydney = new Temporal.ZonedInstant(instant, 'Australia/Sydney');
let nyc = new Temporal.ZonedInstant(instant, 'America/New_York');
sydney.valueOf() //who knows?
sydney === nyc //true or false or error?
```
---
# Min and Max Value
<a href="https://github.com/tc39/proposal-temporal/issues/24">Issue</a>
Does this matter? What should it be?
---
# ZonedInstant vs DateTime
Instant Types:
- Instant
- ZonedInstant
Civil Types:
- CivilDate
- CivilTime
- CivilDateTime
Is it more useful to be able to call a set of objects 'Instant Objects', or to have a 'DateTime' object that people naturally reach for?
---
# Controversies!
<a href="https://github.com/tc39/proposal-temporal/issues/33">Prefixes</a>
Should this be a new global called `Temporal` or integrate with future built-ins spec?
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
</html>