adopted-ember-addons / ember-validators

A collection of EmberJS validators
Other
24 stars 40 forks source link

Configurable date utility or native for date validators #69

Closed snewcomer closed 3 years ago

snewcomer commented 4 years ago

As apps have more options available to them (luxon, date-fns) and moment-core recommends using luxon, we could make this configurable and fallback to browser native. We can also include some of the pitfalls of parsing strings with the Date constructor so ppl know if they might have any issues.

This would allow this validator to have broader use. I'd be happy to do the work.

ref https://github.com/poteto/ember-changeset-validations/pull/208

jherdman commented 4 years ago

Supporting date-fns would be nice to have too. I'm able to help on that front.

snewcomer commented 4 years ago

@jherdman I'm not sure what library you need for this. For e-c-v, we have a basic date validator. We need to improve it with comparing Date as a String. That is probably good enough (w/o date-fns). But if you had another opinion regarding use of a standardized library, I'm all ears (and would love for us to fix in this library)

https://github.com/poteto/ember-changeset-validations/issues/204#issuecomment-619577940

snewcomer commented 3 years ago

@jherdman Do you have write and publish access to this repo?

jherdman commented 3 years ago

Sadly I do not.

snewcomer commented 3 years ago

@offirgolan 👋 Do you think James or I could get contributor + publish rights? There are some changes needed here to support embroider - specifically dynamic resolution + compat with ember-changeset-validations. The only other option I might have is to copy and paste the files we need in e-c-v direction. But hopefully we can continue maintaining this package!

https://github.com/offirgolan/ember-validators/blob/4ec87cd93dfcdeaf24dafd2a7198f1649d76a040/addon/index.js#L6

maxymczech commented 3 years ago

@snewcomer In the meanwhile, how would one use ember-cp-validations with embroider? I am trying to use the following configurations, but it causes Assertion Failed: Validator not found of type: format error:

    packageRules: [{
      package: 'ember-validators',
      addonModules: {
        'index.js': {
          dependsOnModules: [
            'alias',
            'base',
            'belongs-to',
            'collection',
            'confirmation',
            'date',
            'dependent',
            'ds-error',
            'exclusion',
            'format',
            'has-many',
            'inclusion',
            'inline',
            'length',
            'messages',
            'number',
            'presence'
          ].map(validator => `ember-cp-validations/validators/${validator}`)
        },
      },
    }],
offirgolan commented 3 years ago

Apologies for being MIA, I've unfortunately been out of the ember scene for quite some time. @snewcomer I've added you as a collaborator and given you publish access on npm.

snewcomer commented 3 years ago

@offirgolan Thank you and completely understandable! One last issue is we will need the "Required" CI check turned off in order for us to migrate from travis to github actions. I think this is in the "Settings" tab, which I don't have access to.

I can't see the travis run for some reason. Travis still is free with Linux builds but it seems sane to migrate to Actions for better support.

https://github.com/offirgolan/ember-validators/pull/92

offirgolan commented 3 years ago

@snewcomer I've completely removed the travis.ci webhook, hopefully that should be enough to let you fully migrate to GH actions.

snewcomer commented 3 years ago

Hi @offirgolan ! Sry to bother again. It looks like it is in Settings > Branch > Branch protection rules as well that is requiring Travis.

https://docs.github.com/en/github/administering-a-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule

Screen Shot 2021-06-02 at 9 30 19 AM

offirgolan commented 3 years ago

ah! my bad, I thought just disconnecting the webhook would do that. Should be good to go now!