Skip to content

Instantly share code, notes, and snippets.

will i be notified of comemnts?
what about a gist that i dont' stoar?
class MyApp extends Component {
fullCalendar = React.createRef()
render() {
return (
<div>
<button onClick={ this.handleNext }>goto next</button>
<FullCalendar ref={ this.fullCalendar } />
@arshaw
arshaw / temporal-avoid-bigint.js
Created April 6, 2024 00:46
Ways to avoid BigInt while using Temporal
new Temporal.ZonedDateTime(nano, timeZone, calendar)
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
/* */ .toZonedDateTimeISO(timeZone)
/* OR */
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
/* */ .toZonedDateTime({ timeZone, calendar })
zonedDateTime.epochMicroseconds
/* instead: */ zonedDateTime.epochMilliseconds
/*
Called towards the end of Duration::round when either:
- "relativeTo" is a ZonedDateTime
- "relativeTo" is a PlainDate
Also called towards the end of PlainDateTime/PlainDate::since/until when largestUnit > day
Also called towards the end of ZonedDateTime::since/until when largestUnit >= day
Avoids concepts of balancing/unbalancing/normalizing that the original algorithm uses,
a lot of which seems repetitive. Instead, leverages epoch-nanosecond comparisons.
Both more performant and smaller code size.