pikaday 2.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 73

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';
  
Version Uploaded Documentation Archive
2.0.0 Oct 4, 2018 Go to the documentation of pikaday 2.0.0 Download pikaday 2.0.0 archive
1.2.0+1 Feb 2, 2018 Go to the documentation of pikaday 1.2.0+1 Download pikaday 1.2.0+1 archive
1.2.0 Dec 1, 2017 Go to the documentation of pikaday 1.2.0 Download pikaday 1.2.0 archive
1.1.0 Mar 8, 2017 Go to the documentation of pikaday 1.1.0 Download pikaday 1.1.0 archive
1.0.0 Jan 10, 2017 Go to the documentation of pikaday 1.0.0 Download pikaday 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
51
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: web

Primary library: package:pikaday/pikaday.dart with components: html, js.

Health suggestions

Fix lib/date.dart. (-0.50 points)

Analysis of lib/date.dart reported 1 hint:

line 3 col 1: The @JS() annotation can only be used if it is also declared on the library directive.

Format lib/pikaday.dart.

Run dartfmt to format lib/pikaday.dart.

Format lib/pikaday_dart_helpers.dart.

Run dartfmt to format lib/pikaday_dart_helpers.dart.

Maintenance issues and suggestions

Use analysis_options.yaml. (-10 points)

Rename old .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

Fix .analysis_options.

We were unable to parse .analysis_options.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
js >=0.6.0 <1.0.0 0.6.1+1
Dev dependencies
build_runner any
build_web_compilers any
test ^1.3.0