pikaday 2.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

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]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
72
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21

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)

Change the name of your package's .analysis_options file to analysis_options.yaml.

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

Fix .analysis_options.

The analyzer can't parse .analysis_options.

Package is getting outdated. (-17.81 points)

The package was last published 61 weeks ago.

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