Coder Social home page Coder Social logo

mydea / ember-date-components Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 23.0 5.73 MB

An Ember add-on which provides pure Ember-based date picker components.

Home Page: http://mydea.github.io/ember-date-components/

License: MIT License

JavaScript 65.32% HTML 1.18% Handlebars 27.87% SCSS 5.63%
ember date-picker time-picker datepicker date daterange date-range-picker timepicker

ember-date-components's Introduction

ember-date-components

Build Status Ember Observer Score

An Ember add-on which provides pure Ember-based date picker components.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

  • ember install ember-moment - This is a dependency that you will need to install manually
  • ember install ember-date-components

Basic Usage

<DatePicker @value={{this.date}} @onChange={{this.updateDate}} />
<DatePicker @range={{true}} @value={{this.dateRange}} @onChange={{this.updateDateRange}} />
<TimePicker @value={{this.time}} @onChange={{this.updateTime}} />
<DateTimePicker @value={{this.date}} @onChange={{this.updateDateTime}} />

The date picker can also display custom options, e.g. 'Last 7 days'.

It also provides test helpers to easily interact with the date picker in integration & acceptance tests:

import { selectDate, selectDateRange, getSelectedDate, selectDateTime } from 'ember-date-components/test-support/helpers/date-picker';
import { selectTime, getSelectedTime } from 'ember-date-components/test-support/helpers/time-picker';

await selectDate('.my-datepicker', moment());
let momentInstance = await getSelectedDate('.my-datepicker');

await selectTime('.my-timepicker', moment());
let momentInstance = await getSelectedTime('.my-timepicker');

await selectDateTime('.my-date-time-picker', moment());

await selectDateRange('.my-datepicker', dateFrom, dateTo);

For more detailed instructions and examples, please visit the documentation.

ember-date-components's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar dmaok avatar ember-tomster avatar glarregle avatar mixonic avatar mydea avatar ondrejsevcik avatar rafaelbnp avatar rastopyr avatar tmthn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ember-date-components's Issues

`{{with}}` deprecation from ember-basic-dropdown v3

This add-on currently depends on ember-basic-dropdown (EBD) v3, which uses the {{with}} helper which is deprecated (and raises a build-time warning) in Ember v3.26+ and removed in Ember v4.0.

Currently working in an app (which we are slowly working towards upgrading to Ember v4) that directly depends on EBD v6 for other reasons and this package doesn't seem to conflict with it (apart from still raising the warning). Would be willing to submit a PR to update to ember-basic-dropdown v6 (which supports Ember v3.28+), or alternatively allow this package to accept a range of acceptable versions of EBD.

Allow entering of spaces in time-picker

Currently, when you enter a space in the time picker, the current text of the input field will be parsed and interpreted. This makes it impossible to enter e.g. "3:15 pm".

Localizations

Hi,

2 Questions:

  1. Is there a possibillity to localize only all texts without write an option with all params?
  2. Can I add some customized css class names for the picker buttons? ( e.g. Bootstrap "btn btn-primary" )

Best regards,
Mario

Is this project active?

I've been using this addon for long time and I have some suggestions but I do not know if it is maintained.

Addon doesn't work for me

I've got TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.

selectDate test helper

In a spirit of default ember test helpers (that follow principle - tell, don't ask), it would be nice to have a selectDate test helper that would just set a date. Currently it's required to get the datePicker object beforehand.

test('should add new post', async function(assert) {
  await visit('/posts/new');
  await fillIn('input.title', 'My new post');
  
  let datePicker = await getDatePicker('#date-picker');
  await datePicker.toggle();
  await datePicker.selectDate(moment());

  await click('button.submit');
  assert.equal(this.element.querySelector('ul.posts li').textContent, 'My new post');
});

could be written as

test('should add new post', async function(assert) {
  await visit('/posts/new');
  await fillIn('input.title', 'My new post');
  await selectDate('#date-picker', moment());
  await click('button.submit');
  assert.equal(this.element.querySelector('ul.posts li').textContent, 'My new post');
});

My assumption is that most common scenario is that you just want to set a date.
Would you accept PR for a selectDate test helper?

Dates are shown in the wrong weekday.

In ember cli 3.17.0 I'm getting the dates in the wrong weekday.

May should finish on Sunday.
Captura de Pantalla 2020-06-03 a la(s) 21 01 04

Jun starts in the correct weekday:
Captura de Pantalla 2020-06-03 a la(s) 20 59 32

But july starts in a wrong weekday:
Captura de Pantalla 2020-06-03 a la(s) 20 59 49

time-picker button not updating after select

Hiya, the time-picker doesn't seem to update the placeholder or button text after the time is selected. Even on the demo website, it doesn't work (tested on Safari & Chrome). The date-picker works fine, where the button text changes to the selected date - but doesn't do the same for the time.

On top of that, I can't seem to get the date-time-picker to work. I can select the date, but it doesn't trigger to enable me to select the time. The time button remains disabled.

Am I missing something here? Any ideas?

Thanks
S

Keep semantic versioning standards

Hey,
This is not an issue per say, but a request for the maintainers.
Since this is an ember addon with 1,821 downloads in the last month, please, use semantic versioning as it is supposed to be used.

v.1.1.0 should have been released as v2.0.0 since it brought "[POTENTIALLY BREAKING]" changes, which actually broke some of our builds :D

๐Ÿ‘ +1 for keeping the changelog nice and clean.

If you need someone to keep the semantic versioning in check, let me know - I am more than happy to help out :)

Picking a time option has no effect sometimes

In time-picker, picking a time option has no effect sometimes. The issue can be seen in the demos. Seems like a race condition involving the value.

Steps:

  1. click the time-picker input
  2. click a time option
  3. click the time-picker input
  4. click a different time option

Expected: time-picker input's value is the value of the option selected the second time
Actual: time-picker input's value is the value of the option selected the first time

Notes: slowing things down, e.g. by adding a console.log() in the selectValue action, seems to make encountering this behavior less probable.

Prettier run messed up Ember.get calls

It looks like a prettier run messed up a bunch of Ember.get calls. This appears to be the case with every release after v2.0.6. An example is in time-picker.js.

After Prettier:

let { value, format } = this;

Before Prettier:
36e29c2#diff-dd2ea6f43e83040327c685e5bbcc1753L321

As you can see this:

    let value = get(this, 'value');
    let format = get(this, 'format');

Was changed to this:

let { value, format } = this;

I don't believe this type of object destructuring works for accessing Ember properties...at least not that I'm aware of, and not in my version of Ember, which causes various things to break if I upgrade beyond v2.0.6.

Selected Date for date-picker block style

I am trying to implement the date-picker via block style, similar to the Custom Button on your website, and I am unable to get it to highlight a previously selected date. I noticed the Custom Button example you have also does not highlight the previously selected date unless I navigate to a different month and then back. Is this a bug or intended design? Either way, would it be possible to add this feature? Really liking the picker btw!

[FEATURE] Add support for languages

Can you ad support for different languages?

like
{{date-picker lang=''language" action=(action 'updateDateRange')}}

or that I can set by my own the names of months and weekdays

let myOptions = [
{
  weekdays: ['mo', 'di', 'mi', 'do', 'fr', 'sa', 'so']
  months: ['Januar', 'Februar'/*...*/]
}];

Update docs to indicate value=[prop] is required

In trying to figure out why the example usage codes weren't giving me the same results in my app as in the docs, I decided to look at the dummy app to see how they were actually implemented there. I realized that I needed to give the component a value. Silly me; I should've figured that out sooner. But would be nice to note this in the docs and usage examples.

Problem with Timepicker in a modal

Hello,
I'm trying to use ember-date-components in a Bootstrap's modal.

The date picker is working great, but I face an issue with the time picker:
When the I click on the time input, the time list is showing, including a scrollbar.
When I click on the scrollbar, the list closes immediately, I don't have time to scroll up or down.

In fact, when I click the scrollbar, the input looses focus , so the focus-out action is triggered and the list closes.
Temporarily, I disabled the focus-out action, but the list is closing only if the user picks a time, not if he clicks out of the list.

Can you give me some insights on how to solve this issue ?
Thanks !

More options when range=true

Could there be an option to remove or change the small dash between the 2 date-pickers? Maybe add an option to put a snippet of html between them with the dash as a default value? That way you can make it null to remove it all together or add something else.

And it would be nice if we could add 2 placeholders since there are 2 fields. A user can label them "Start Date" and "End Date" but currently are unable to do so.

.git folder available on npm

Hi! Can you check your npmjs registry?
I got this message after ember install.

npm ERR! path /node_modules/ember-date-components
npm ERR! code EISGIT
npm ERR! git /node_modules/ember-date-components: Appears to be a git repo or submodule.
npm ERR! git  /node_modules/ember-date-components
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

Picking a date triggers a form action

Changing input to button in this commit breaks forms.

Button by default triggers action on from so if the form has an action

<form {{action "save"" on="submit"}}>

it's going to be triggered.

I think that adding type="button" on a button should fix it. Can provide PR.

[FEATURE] Add support for timezones

Occasionally it is useful to display a date picker in a different timezone than the current user's. It mainly affects the current today value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.