Skip to content

Instantly share code, notes, and snippets.

class MyApp extends Component {
fullCalendar = React.createRef()
render() {
return (
<div>
<button onClick={ this.handleNext }>goto next</button>
<FullCalendar ref={ this.fullCalendar } />
@arshaw
arshaw / sample_french.js
Last active October 21, 2019 05:04
Sample language config for FullCalendar in the French language
// The goal of this language config is to give FullCalendar everything it needs for
// translations (in this case, French). This happens to be a merge of Moment's and
// the jQuery UI datepicker's configs, in addition to some other strings.
//
// Additionally, when this config is loaded, Moment and the jQuery UI datepicker
// (if it is on the page) will also be initialized.
//
(function(){
function onload (moment, $) {
@arshaw
arshaw / xdate_changing_locale.js
Created September 16, 2011 06:42
XDate: Changing the Locale
// You can add new locales by adding a new object to the `XDate.locales` hash.
// You can change the default locale by changing `XDate.defaultLocale`.
XDate.locales['fr'] = {
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin','Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.']
};
@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.