CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-flatpickr

A lightweight, powerful javascript datetime picker

95

1.06x
Overview
Eval results
Files

task.mdevals/scenario-2/

International Event Scheduler

Build a simple event scheduler application that displays dates in different languages based on user preference. The application should support multiple locales and format dates appropriately for each locale.

Requirements

Create a function that initializes a date picker for scheduling events with the following capabilities:

  1. Multi-language Support: Support English (US), German, and Japanese locales

  2. Locale Switching: Allow switching between locales to update month names, weekday names, and date format

  3. Custom Date Formatting: Display dates in locale-appropriate formats

  4. Default Configuration: Initialize with a specified locale

Implementation

@generates

Create a function createEventScheduler(inputElement, defaultLocale) that:

  • Takes an input element and a default locale code as parameters
  • Initializes the date picker with the specified locale
  • Returns an object with a changeLocale(localeCode) method to switch languages

Test Cases

  • The picker initializes with English locale and displays "January" for month 0 @test
  • The picker initializes with German locale and displays "Januar" for month 0 @test
  • Calling changeLocale switches from English to Japanese locale @test

API

/**
 * Creates an event scheduler with locale-aware date display
 * @param {HTMLInputElement} inputElement - The input element to attach the picker to
 * @param {string} defaultLocale - The default locale code (e.g., 'en', 'de', 'ja')
 * @returns {Object} An object with a changeLocale method
 */
function createEventScheduler(inputElement, defaultLocale) {
  // Implementation here
}

Dependencies { .dependencies }

flatpickr { .dependency }

Provides date picker functionality with localization support.

Install with Tessl CLI

npx tessl i tessl/npm-flatpickr

tile.json