For the complete documentation index, see llms.txt. This page is also available as Markdown.

πŸ“…Date Picker

Display a native date, time, or date and time picker in your app.

What is Date Picker?

The Date Picker feature lets you show a native date and time selection UI - the same picker the user sees in other apps on their device. It supports three modes: date only, time only, or date and time combined. The result is returned as a timestamp in milliseconds, which you can convert to any date format your app needs.

Prerequisites

Implementation

Choose your integration method below: Bubble.io Plugin (No-Code), JavaScript SDK (Code), or AI Agents (for AI-powered editors like Lovable, Base44, and Replit).

Initialization

Check Plugin

Before starting, verify if the Natively plugin is already installed in your Bubble project.

  1. Open your Bubble editor and navigate to the Plugins tab in the left sidebar.

  2. Check Installed Plugins: Look through your list of installed plugins for "Natively iOS & Android app builder".

    • If it IS installed: Check the version number. If an update is available (e.g., you see a button saying "Update"), click it to ensure you have the latest features and bug fixes.

  • If it is NOT installed: Click the + Add plugins button, search for "Natively", and click Install.

Setup Logic

[Element] Natively - Date Picker

Events:

  • Date selected

  • Date Picker closed

States:

  • Selected Date

Actions:

  • Show Date Picker

    • Title - label shown at the top of the picker.

    • Description - optional subtitle shown below the title (iOS only - may not have a visible effect on Android).

    • Type - DATE, TIME, or DATE_AND_TIME .

    • Style - DARK or LIGHT .

How to use

Choose the right type

Use DATE for date-only inputs like birthdays or booking dates, TIME for scheduling or time-based inputs, and DATE_AND_TIME when you need both - for example, scheduling a meeting or setting a reminder.

Converting the timestamp

The picker returns milliseconds since epoch via resp.date. Convert it to a JavaScript Date object with new Date(Number(resp.date)). From there, you can format it however your app needs - as a readable string, store it in your database, or pass it to another function.

Handling dismissal

If the user closes the picker without selecting a date, resp.date will return an invalid date. Always check with isNaN(date.getTime()) before using the value to avoid passing invalid data to your app logic.

Match the picker style to your app

Use LIGHT or DARK to match your app's visual theme. If your app supports both light and dark modes, consider reading the current mode from Device Info and passing it dynamically to the picker.

Troubleshooting

The selected date is invalid or NaN

The user dismissed the picker without making a selection. This is expected behavior - always validate the returned value with isNaN(date.getTime()) before using it in your app logic.

Description not visible on Android

The description field may only have a visible effect on iOS. If you need to display additional context on Android, consider adding it as a label in your app's UI instead.

Wrong date format returned

The picker always returns milliseconds since epoch - not a formatted date string. Use new Date(Number(resp.date)) to convert it, then apply your preferred formatting library or method.

Date picker not appearing

Make sure the Natively SDK is fully loaded before calling picker.showDatePicker(). Trigger it via a user interaction after the SDK has initialized.

Style not applying correctly

Make sure the style parameter is either "LIGHT" or "DARK" - any other value may cause unexpected behavior.

Last updated