SlideShare ist ein Scribd-Unternehmen logo
1 von 48
PROGRAMMING IN THE 4TH
DIMENSION
MAKING TIME MAKE SENSE
Maggie Johnson-Pint
magpint@Microsoft.com
@maggiepint
A day in the life of Maggie.
"Ocean Sunrise" by sombraala is licensed under CC BY-NC-SA
2.0
HEY MAGGIE – CAN I HAVE A
MOMENT?
(HA, HA, HA)
DID YOU KNOW…
• ABOUT THIS GREAT FALSEHOODS PROGRAMMERS BELIEVE ABOUT TIME VIDEO?
• THE PLACES WHERE MIDNIGHT DOESN’T EXIST?
• LEAP YEAR 2012 BRICKED EVERY ZUNE FOR A DAY?
• WE MIGHT COLONIZE MARS SOON? WE’LL NEED TIME THERE TOO!
• THERE’S SOME COUNTRY SOMEWHERE WHERE A WHOLE DAY IS MISSING DUE TO A TIME ZONE
CHANGE?
• THERE IS A GAP BETWEEN THE JULIAN AND GREGORIAN CALENDARDS?
YES. YES I DO.
"Soi dog - Bangkok" by ashabot is licensed under CC BY-NC-SA
AS PROGRAMMERS, WE OFTEN THINK ABOUT DATE AND TIME
PROBLEMS AS A SORT OF “FUN TRIVIA”.
GETTING THIS STUFF RIGHT MATTERS.
• DATE AND TIME PROBLEMS ARE PRIMARY APPLICATIONS IN COMPUTING
• GETTING THESE PROBLEMS WRONG PROFOUNDLY AFFECTS IMPORTANT STUFF
• PEOPLE GETTING PLACES ON TIME
• PAYCHECKS HAVING THE RIGHT AMOUNT OF MONEY
• COORDINATING INTERNATIONAL CONFERENCE CALLS
• MEDICAL DEVICE BEHAVIOR
• POOR PRACTICES IN DATE TIME PROGRAMMING DISPROPORTIONATELY AFFECT
• NON-ENGLISH SPEAKING PEOPLE
• HOURLY WAGE WORKERS
• PEOPLE IN OTHER TIME ZONES
MEET THE WORST SOLUTION POSSIBLE.
new Date();
ate()
DATE HAS A LOT OF
PROBLEMS
MONTHS INDEX FROM ZERO?
let a = new Date(2019,12,3);
console.log(a.toISOString()); //2020-01-03T06:00:00.000Z
MUTABILITY
function addDays(date, days) {
date.setDate(date.getDay() + days)
return date;
}
let a = new Date('2019-12-03');
let b = addDays(a, 3);
console.log(a.toISOString()) // 2019-12-05T00:00:00.000Z
console.log(b.toISOString()) // 2019-12-05T00:00:00.000Z
TIME ZONE GAPS
I NEED TO MEET WITH THE SAN FRANCISCO OFFICE AT 9:00 THEIR TIME NEXT WEEK. WHAT TIME IS IT HERE?
NO IDEA.
console.log(new Date().toString())
// Tue Dec 03 2019 16:03:27 GMT-0600 (Central Standard Time)
console.log(new Date().toISOString())
// 2019-12-03T22:03:27.533Z
NO DATE-ONLY REPRESENTATION
let sulusBirthday = new Date('2014-09-12');
console.log(sulusBirthday.toDateString()); // Thu Sep 11 2014
INEXPLICABLE PARSE BEHAVIORS
let sulusBirthday = new Date('2014-09-12');
console.log(sulusBirthday.toISOString());
// 2014-09-12T00:00:00.000Z
let sulusBirthdayAtMidnight = new Date('2014-09-12T00:00:00')
console.log(sulusBirthdayAtMidnight.toISOString());
// 2014-09-12T07:00:00.000Z
SULU IS MY
DOG
HE’S VERY CUTE
“
”
A DOMAIN MODEL IS A SYSTEM OF
ABSTRACTIONS THAT DESCRIBES SELECTED
ASPECTS OF A SPHERE OF KNOWLEDGE,
INFLUENCE OR ACTIVITY
ERIC EVANS – DOMAIN DRIVEN DESIGN
WHAT IS A DOMAIN MODEL?
THE TEMPORAL PROPOSAL IN TC39
PROVIDES A COMPLETE DOMAIN MODEL
TEMPORAL WILL BE A
NEW GLOBAL
PENDING WEB COMPATIBILITY TESTING
new Temporal.Date(2020,01,01);
new Temporal.Absolute(1574074321816000000n);
NEW TYPES
• TEMPORAL.ABSOLUTE
• TEMPORAL.DATETIME
• TEMPORAL.DATE
• TEMPORAL.TIME
• TEMPORAL.TIMEZONE
• TEMPORAL.DURATION
• TEMPORAL.YEARMONTH
• TEMPORAL.MONTHDAY
ABSOLUTE
Date()
Absolute Time
(Temporal.Absolute)
THE GLOBAL TIMELINE
1 2 3 4 5 6 7 8 9
Point in absolute time
ABSOLUTE SCENARIOS
• LOG DATA
• POINT-IN-TIME EVENTS
TEMPORAL.ABSOLUTE()
new Temporal.Absolute(epochNanoSeconds : bigint)
const date = new Temporal.Absolute(1574074321816000000n);
date.toString(); // 2019-11-18T10:52:01.816Z
Temporal.Absolute.from(thing: string | object)
const date = Temporal.Absolute.from("2019-11-18T11:00:00.000Z");
date.toString(); // 2019-11-18T11:00Z
DATETIME
Date()
Absolute Time
(Temporal.Absolute)
Local Date and Time
(Temporal.DateTime)
LOCAL TIME
TEMPORAL.DATETIME
• A LOCAL TIME IS A PERSPECTIVE OF TIME
• IT DOES NOT REPRESENT A POINT ON THE
GLOBAL TIMELINE
• IT OFTEN NOT A CONTIGUOUS TIMELINE
(DST, TIME ZONE SHIFTS)
DATETIME SCENARIOS
• DATES AND TIMES ON NON-CONNECTED DEVICES LIKE WATCHES, FITBITS, TIME CLOCKS OR
INSULIN PUMPS
USING DATETIME
let timeFromDeviceString = '2019-12-05T08:12:03.001';
let localDateTime = Temporal.DateTime.from(timeFromDeviceString);
TIMEZONE
Date()
Absolute Time
(Temporal.Absolute)
Local Date and Time
(Temporal.DateTime)
Temporal.TimeZone
TEMPORAL.TIMEZONE
• REPRESENTS ONE OF:
• UTC
• FIXED OFFSET (+01:00)
• IANA TIME ZONE (EUROPE/PARIS)
• KEEP IN MIND – AN IANA TIME ZONE IS A COLLECTION OF HISTORICAL OFFSETS OVER TIME
• WHEN COMBINED WITH AN ABSOLUTE OR A DATETIME, PRESENTS A COMPLETE PICTURE OF A
POINT IN TIME
• DATE AND TIME, LOCAL AND UTC
WHAT POINT IN TIME DID THIS INSULIN PUMP RUN
AT?
let timeFromDeviceString = '2019-12-05T08:12:03.001';
let userProvidedTz = 'Europe/Paris';
let localDateTime = Temporal.DateTime.from(timeFromDeviceString);
let timeZone = new Temporal.TimeZone(userProvidedTz);
let globalTime = timeZone.getAbsoluteFor(localDateTime);
DATE
Date()
Absolute Time
(Temporal.Absolute)
Local Date and Time
(Temporal.DateTime)
Temporal.TimeZone
Date Only
(Temporal.Date)
TEMPORAL.DATE
• REPRESENTS A DATE WITHOUT A TIME
• PREVENTS ‘TIME ASSUMPTION’ ERRORS THAT CAUSE UNEXPECTED BEHAVIOR
• SCENARIOS:
• DATES OF BIRTH
• EMPLOYMENT HIRING DATES
• HOLIDAYS
• REPORT GROUPINGS
• “FOR THE BUSINESS DAY OF”
SULU’S BIRTHDAY – MADE BETTER
let birthday = Temporal.Date.from(‘2014-09-12');
console.log(birthday.toString()) //2014-09-12
let birthdayLong = Temporal.Date.from(‘2014-09-12T00:00:00.000');
console.log(birthdayLong.toString()) //2014-09-12
console.log(birthdayLong.day) // 12
console.log(birthdayLong.hour) // undefined
TIME
Date()
Absolute Time
(Temporal.Absolute)
Local Date and Time
(Temporal.DateTime)
Temporal.TimeZone
Date Only
(Temporal.Date)
Time Only
(Temporal.Time)
TEMPORAL.TIME
• REPRESENTS A TIME WITHOUT A DATE
• PREVENTS ‘DATE ASSUMPTION’ ERRORS THAT CAUSE UNEXPECTED BEHAVIOR
• SCENARIOS:
• RECURRING MEETING SCHEDULES
• DATA FROM NON-CONNECTED CLOCKS
FINDING UTC POINT-IN-TIME OF RECURRING
MEETING
let meeting1 = Temporal.Date.from('2020-01-01');
let meeting2 = Temporal.Date.from('2020-04-01');
let time = Temporal.Time.from('10:00:00');
let timeZone = new Temporal.TimeZone('Europe/Paris');
let absolute1 = timeZone.getAbsoluteFor(meeting1.withTime(time));
// 2020-01-01T09:00:00.000Z
let absolute2 = timeZone.getAbsoluteFor(meeting2.withTime(time));
// 2020-04-01T08:00:00.000Z
ProTip: Store recurring meeting times in local
and convert
DURATION
Date()
Absolute Time
(Temporal.Absolute)
Local Date and Time
(Temporal.DateTime)
Temporal.TimeZone
Date Only
(Temporal.Date)
Time Only
(Temporal.Time)
Duration
(Temporal.Duration)
TEMPORAL.DURATION
• USED TO EXPRESS LENGTHS OF TIME
• USEFUL TO FORMAT IN AND OF ITSELF
• “SHE WON THE RACE WITH A TIME OF 00:05:25.122”
• USED TO ADD AND SUBTRACT AMOUNTS OF TIME FROM ABSOLUTE, DATETIME, DATE, TIME
• RETURN VALUE OF A DIFFERENCE FUNCTION BETWEEN TWO ABSOLUTES OR DATES OR TIMES
EXACTLY HOW OLD IS MR SULU?
let birthday = Temporal.Date.from('2014-09-12');
let age = Temporal.getDate().difference(birthday);
// P5Y2M3W4D
OTHER GOOD STUFF
SO MUCH CONTENT, SO LITTLE TIME
YEAR/MONTH AND MONTH/DAY
• YEARMONTH IS USED TO REPRESENT REPORTING PERIODS, HISTORICAL TIMEFRAMES, ETC
• DECEMBER OF 2019
• MONTHDAY IS USED TO REPRESENT RECURRING DATES LIKE HOLIDAYS OR BIRTHDAYS
• MR SULU’S BIRTHDAY IS SEPTEBMBER 12
• NEW YEAR’S DAY IS JANUARY 1
ALTERNATE CALENDARS
• TC39 IS WORKING ON WAYS TO SUPPORT ALTERNATE CALENDAR SYSTEMS LIKE:
• HEBREW
• HIJRI
• JAPANESE
• AND MANY MORE
• THIS DISCUSSION IS VERY EARLY AND YOUR FEEDBACK WOULD BE VERY HELPFUL
• IF YOU USE A CALENDAR SYSTEM OTHER THAN GREGORIAN REGULARLY, WHEN AND HOW?
• HTTPS://GITHUB.COM/TC39/PROPOSAL-TEMPORAL/ISSUES/268
HOW DO WE GET THIS DONE?
STANDARDS AND THEIR PROCESSES
TEMPORAL IS
CURRENTLY
AT STAGE 2
• TC39 HAS A 4-STAGE PROCESS FOR MOVING PROPOSALS
FORWARD
• WHEN TEMPORAL REACHES STAGE 3, ENGINES WILL PICK IT
UP FOR A TEST IMPLEMENTATION
• UNTIL STAGE 3, APIS ARE INCREDIBLY UNSTABLE
• GOOD NEWS – AT A TOP LEVEL EVERYONE WANTS IT
CONTRIBUTING
• WE WELCOME CONTRIBUTIONS TO THE TEMPORAL SPECIFICATION AND POLYFILL
• YOU CAN FIND IT AT HTTPS://GITHUB.COM/TC39/PROPOSAL-TEMPORAL
• THE POLYFILL IS IN THIS REPO – CHECK IT OUT!
• WE WILL PUBLISH WHEN API IS STABLE
THANK YOU TO INCREDIBLE PEOPLE
• PHILIPP DUNKEL (BLOOMBERG)
• MATT JOHNSON-PINT (MICROSOFT)
• DANIEL EHRENBERG (IGALIA)
• RICHARD GIBSON (ORACLE)
• SHANE CARR (GOOGLE)
• BRIAN TERLSON (MICROSOFT)
• UJJWAL SHARMA (IGALIA)
• MS2GER (IGALIA)
MAGGIE JOHNSON-PINT
MAGPINT@MICROSOFT.COM
@MAGGIEPINT
HTTPS://GITHUB.COM/TC39/PROPOSAL-TEMPORAL

Weitere ähnliche Inhalte

Kürzlich hochgeladen

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Kürzlich hochgeladen (20)

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Programming in the 4th Dimension

  • 1. PROGRAMMING IN THE 4TH DIMENSION MAKING TIME MAKE SENSE Maggie Johnson-Pint magpint@Microsoft.com @maggiepint
  • 2. A day in the life of Maggie. "Ocean Sunrise" by sombraala is licensed under CC BY-NC-SA 2.0
  • 3. HEY MAGGIE – CAN I HAVE A MOMENT? (HA, HA, HA)
  • 4. DID YOU KNOW… • ABOUT THIS GREAT FALSEHOODS PROGRAMMERS BELIEVE ABOUT TIME VIDEO? • THE PLACES WHERE MIDNIGHT DOESN’T EXIST? • LEAP YEAR 2012 BRICKED EVERY ZUNE FOR A DAY? • WE MIGHT COLONIZE MARS SOON? WE’LL NEED TIME THERE TOO! • THERE’S SOME COUNTRY SOMEWHERE WHERE A WHOLE DAY IS MISSING DUE TO A TIME ZONE CHANGE? • THERE IS A GAP BETWEEN THE JULIAN AND GREGORIAN CALENDARDS?
  • 5. YES. YES I DO. "Soi dog - Bangkok" by ashabot is licensed under CC BY-NC-SA
  • 6. AS PROGRAMMERS, WE OFTEN THINK ABOUT DATE AND TIME PROBLEMS AS A SORT OF “FUN TRIVIA”.
  • 7. GETTING THIS STUFF RIGHT MATTERS. • DATE AND TIME PROBLEMS ARE PRIMARY APPLICATIONS IN COMPUTING • GETTING THESE PROBLEMS WRONG PROFOUNDLY AFFECTS IMPORTANT STUFF • PEOPLE GETTING PLACES ON TIME • PAYCHECKS HAVING THE RIGHT AMOUNT OF MONEY • COORDINATING INTERNATIONAL CONFERENCE CALLS • MEDICAL DEVICE BEHAVIOR • POOR PRACTICES IN DATE TIME PROGRAMMING DISPROPORTIONATELY AFFECT • NON-ENGLISH SPEAKING PEOPLE • HOURLY WAGE WORKERS • PEOPLE IN OTHER TIME ZONES
  • 8. MEET THE WORST SOLUTION POSSIBLE. new Date(); ate()
  • 9. DATE HAS A LOT OF PROBLEMS
  • 10. MONTHS INDEX FROM ZERO? let a = new Date(2019,12,3); console.log(a.toISOString()); //2020-01-03T06:00:00.000Z
  • 11. MUTABILITY function addDays(date, days) { date.setDate(date.getDay() + days) return date; } let a = new Date('2019-12-03'); let b = addDays(a, 3); console.log(a.toISOString()) // 2019-12-05T00:00:00.000Z console.log(b.toISOString()) // 2019-12-05T00:00:00.000Z
  • 12. TIME ZONE GAPS I NEED TO MEET WITH THE SAN FRANCISCO OFFICE AT 9:00 THEIR TIME NEXT WEEK. WHAT TIME IS IT HERE? NO IDEA. console.log(new Date().toString()) // Tue Dec 03 2019 16:03:27 GMT-0600 (Central Standard Time) console.log(new Date().toISOString()) // 2019-12-03T22:03:27.533Z
  • 13. NO DATE-ONLY REPRESENTATION let sulusBirthday = new Date('2014-09-12'); console.log(sulusBirthday.toDateString()); // Thu Sep 11 2014
  • 14. INEXPLICABLE PARSE BEHAVIORS let sulusBirthday = new Date('2014-09-12'); console.log(sulusBirthday.toISOString()); // 2014-09-12T00:00:00.000Z let sulusBirthdayAtMidnight = new Date('2014-09-12T00:00:00') console.log(sulusBirthdayAtMidnight.toISOString()); // 2014-09-12T07:00:00.000Z
  • 16.
  • 17. “ ” A DOMAIN MODEL IS A SYSTEM OF ABSTRACTIONS THAT DESCRIBES SELECTED ASPECTS OF A SPHERE OF KNOWLEDGE, INFLUENCE OR ACTIVITY ERIC EVANS – DOMAIN DRIVEN DESIGN WHAT IS A DOMAIN MODEL?
  • 18. THE TEMPORAL PROPOSAL IN TC39 PROVIDES A COMPLETE DOMAIN MODEL
  • 19. TEMPORAL WILL BE A NEW GLOBAL PENDING WEB COMPATIBILITY TESTING new Temporal.Date(2020,01,01); new Temporal.Absolute(1574074321816000000n);
  • 20. NEW TYPES • TEMPORAL.ABSOLUTE • TEMPORAL.DATETIME • TEMPORAL.DATE • TEMPORAL.TIME • TEMPORAL.TIMEZONE • TEMPORAL.DURATION • TEMPORAL.YEARMONTH • TEMPORAL.MONTHDAY
  • 22. THE GLOBAL TIMELINE 1 2 3 4 5 6 7 8 9 Point in absolute time
  • 23. ABSOLUTE SCENARIOS • LOG DATA • POINT-IN-TIME EVENTS
  • 24. TEMPORAL.ABSOLUTE() new Temporal.Absolute(epochNanoSeconds : bigint) const date = new Temporal.Absolute(1574074321816000000n); date.toString(); // 2019-11-18T10:52:01.816Z Temporal.Absolute.from(thing: string | object) const date = Temporal.Absolute.from("2019-11-18T11:00:00.000Z"); date.toString(); // 2019-11-18T11:00Z
  • 26. LOCAL TIME TEMPORAL.DATETIME • A LOCAL TIME IS A PERSPECTIVE OF TIME • IT DOES NOT REPRESENT A POINT ON THE GLOBAL TIMELINE • IT OFTEN NOT A CONTIGUOUS TIMELINE (DST, TIME ZONE SHIFTS)
  • 27. DATETIME SCENARIOS • DATES AND TIMES ON NON-CONNECTED DEVICES LIKE WATCHES, FITBITS, TIME CLOCKS OR INSULIN PUMPS
  • 28. USING DATETIME let timeFromDeviceString = '2019-12-05T08:12:03.001'; let localDateTime = Temporal.DateTime.from(timeFromDeviceString);
  • 29. TIMEZONE Date() Absolute Time (Temporal.Absolute) Local Date and Time (Temporal.DateTime) Temporal.TimeZone
  • 30. TEMPORAL.TIMEZONE • REPRESENTS ONE OF: • UTC • FIXED OFFSET (+01:00) • IANA TIME ZONE (EUROPE/PARIS) • KEEP IN MIND – AN IANA TIME ZONE IS A COLLECTION OF HISTORICAL OFFSETS OVER TIME • WHEN COMBINED WITH AN ABSOLUTE OR A DATETIME, PRESENTS A COMPLETE PICTURE OF A POINT IN TIME • DATE AND TIME, LOCAL AND UTC
  • 31. WHAT POINT IN TIME DID THIS INSULIN PUMP RUN AT? let timeFromDeviceString = '2019-12-05T08:12:03.001'; let userProvidedTz = 'Europe/Paris'; let localDateTime = Temporal.DateTime.from(timeFromDeviceString); let timeZone = new Temporal.TimeZone(userProvidedTz); let globalTime = timeZone.getAbsoluteFor(localDateTime);
  • 32. DATE Date() Absolute Time (Temporal.Absolute) Local Date and Time (Temporal.DateTime) Temporal.TimeZone Date Only (Temporal.Date)
  • 33. TEMPORAL.DATE • REPRESENTS A DATE WITHOUT A TIME • PREVENTS ‘TIME ASSUMPTION’ ERRORS THAT CAUSE UNEXPECTED BEHAVIOR • SCENARIOS: • DATES OF BIRTH • EMPLOYMENT HIRING DATES • HOLIDAYS • REPORT GROUPINGS • “FOR THE BUSINESS DAY OF”
  • 34. SULU’S BIRTHDAY – MADE BETTER let birthday = Temporal.Date.from(‘2014-09-12'); console.log(birthday.toString()) //2014-09-12 let birthdayLong = Temporal.Date.from(‘2014-09-12T00:00:00.000'); console.log(birthdayLong.toString()) //2014-09-12 console.log(birthdayLong.day) // 12 console.log(birthdayLong.hour) // undefined
  • 35. TIME Date() Absolute Time (Temporal.Absolute) Local Date and Time (Temporal.DateTime) Temporal.TimeZone Date Only (Temporal.Date) Time Only (Temporal.Time)
  • 36. TEMPORAL.TIME • REPRESENTS A TIME WITHOUT A DATE • PREVENTS ‘DATE ASSUMPTION’ ERRORS THAT CAUSE UNEXPECTED BEHAVIOR • SCENARIOS: • RECURRING MEETING SCHEDULES • DATA FROM NON-CONNECTED CLOCKS
  • 37. FINDING UTC POINT-IN-TIME OF RECURRING MEETING let meeting1 = Temporal.Date.from('2020-01-01'); let meeting2 = Temporal.Date.from('2020-04-01'); let time = Temporal.Time.from('10:00:00'); let timeZone = new Temporal.TimeZone('Europe/Paris'); let absolute1 = timeZone.getAbsoluteFor(meeting1.withTime(time)); // 2020-01-01T09:00:00.000Z let absolute2 = timeZone.getAbsoluteFor(meeting2.withTime(time)); // 2020-04-01T08:00:00.000Z ProTip: Store recurring meeting times in local and convert
  • 38. DURATION Date() Absolute Time (Temporal.Absolute) Local Date and Time (Temporal.DateTime) Temporal.TimeZone Date Only (Temporal.Date) Time Only (Temporal.Time) Duration (Temporal.Duration)
  • 39. TEMPORAL.DURATION • USED TO EXPRESS LENGTHS OF TIME • USEFUL TO FORMAT IN AND OF ITSELF • “SHE WON THE RACE WITH A TIME OF 00:05:25.122” • USED TO ADD AND SUBTRACT AMOUNTS OF TIME FROM ABSOLUTE, DATETIME, DATE, TIME • RETURN VALUE OF A DIFFERENCE FUNCTION BETWEEN TWO ABSOLUTES OR DATES OR TIMES
  • 40. EXACTLY HOW OLD IS MR SULU? let birthday = Temporal.Date.from('2014-09-12'); let age = Temporal.getDate().difference(birthday); // P5Y2M3W4D
  • 41. OTHER GOOD STUFF SO MUCH CONTENT, SO LITTLE TIME
  • 42. YEAR/MONTH AND MONTH/DAY • YEARMONTH IS USED TO REPRESENT REPORTING PERIODS, HISTORICAL TIMEFRAMES, ETC • DECEMBER OF 2019 • MONTHDAY IS USED TO REPRESENT RECURRING DATES LIKE HOLIDAYS OR BIRTHDAYS • MR SULU’S BIRTHDAY IS SEPTEBMBER 12 • NEW YEAR’S DAY IS JANUARY 1
  • 43. ALTERNATE CALENDARS • TC39 IS WORKING ON WAYS TO SUPPORT ALTERNATE CALENDAR SYSTEMS LIKE: • HEBREW • HIJRI • JAPANESE • AND MANY MORE • THIS DISCUSSION IS VERY EARLY AND YOUR FEEDBACK WOULD BE VERY HELPFUL • IF YOU USE A CALENDAR SYSTEM OTHER THAN GREGORIAN REGULARLY, WHEN AND HOW? • HTTPS://GITHUB.COM/TC39/PROPOSAL-TEMPORAL/ISSUES/268
  • 44. HOW DO WE GET THIS DONE? STANDARDS AND THEIR PROCESSES
  • 45. TEMPORAL IS CURRENTLY AT STAGE 2 • TC39 HAS A 4-STAGE PROCESS FOR MOVING PROPOSALS FORWARD • WHEN TEMPORAL REACHES STAGE 3, ENGINES WILL PICK IT UP FOR A TEST IMPLEMENTATION • UNTIL STAGE 3, APIS ARE INCREDIBLY UNSTABLE • GOOD NEWS – AT A TOP LEVEL EVERYONE WANTS IT
  • 46. CONTRIBUTING • WE WELCOME CONTRIBUTIONS TO THE TEMPORAL SPECIFICATION AND POLYFILL • YOU CAN FIND IT AT HTTPS://GITHUB.COM/TC39/PROPOSAL-TEMPORAL • THE POLYFILL IS IN THIS REPO – CHECK IT OUT! • WE WILL PUBLISH WHEN API IS STABLE
  • 47. THANK YOU TO INCREDIBLE PEOPLE • PHILIPP DUNKEL (BLOOMBERG) • MATT JOHNSON-PINT (MICROSOFT) • DANIEL EHRENBERG (IGALIA) • RICHARD GIBSON (ORACLE) • SHANE CARR (GOOGLE) • BRIAN TERLSON (MICROSOFT) • UJJWAL SHARMA (IGALIA) • MS2GER (IGALIA)