pikaday 2.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 20

pikaday #

package:js bindings for Pikaday by David Bushnell.

This includes a version of Pikaday with time support

Usage #

main() {
  new Pikaday(new PikadayOptions(
    field: document.getElementById('datepicker'),
    firstDay: 1,
    minDate: new DateTime.now(),
    maxDate: new DateTime(2020, 12, 31),
    yearRange: [2000, 2020],
    showTime: false,
  ));
}

Generating the library #

dart_js_facade_gen lib/pikaday.d.ts > lib/pikaday.dart

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

1.2.0 #

  • add helper method: setDate as milliseconds on pikaday
  • add helper method: setMinDate as milliseconds on pikaday
  • add helper method: setMaxDate as milliseconds on pikaday

1.1.0 #

  • add helper method: get milliseconds from pikaday

1.0.0 #

  • Initial version

example/main.dart

// Copyright (c) 2017, john. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:html';
import 'dart:js';
import 'package:pikaday/pikaday.dart';
import 'package:pikaday/pikaday_dart_helpers.dart';
import 'package:js/js.dart';

main() {
  new Pikaday(new PikadayOptions(
    field: document.getElementById('datepicker'),
    firstDay: 1,
    minDate: new DateTime.now(),
    maxDate: new DateTime(2020, 12, 31),
    yearRange: [2000, 2020],
    showTime: false,
  ));

  new Pikaday(new PikadayOptions(
      field: document.getElementById('datetimepicker'),
      firstDay: 1,
      minDate: new DateTime(2000, 0, 1),
      maxDate: new DateTime(2020, 12, 31),
      yearRange: [2000, 2020],
      showTime: true,
      autoClose: false,
      use24hour: false));

  Pikaday manual;
  void handleDateSelected() {
    var ms = getPikadayMillisecondsSinceEpoch(manual);
    var date = new DateTime.fromMillisecondsSinceEpoch(ms);
    print(date);
  }

  manual = new Pikaday(new PikadayOptions(
      field: document.getElementById('manualpicker'),
      firstDay: 1,
      minDate: new DateTime(2000, 0, 1),
      maxDate: new DateTime(2020, 12, 31),
      yearRange: [2000, 2020],
      showTime: true,
      autoClose: false,
      use24hour: false,
      onClose: allowInterop(handleDateSelected)));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pikaday: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pikaday/pikaday.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
20
Learn more about scoring.

This package is not analyzed, because it is discontinued.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0