vue-convenia-util
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -125,6 +125,5 @@ 'use strict'; | ||
* @example ``` | ||
* ('2000-21-12') => 'YYYY-DD-MM' | ||
* ('21-12-2000') => 'DD-MM-YYYY' | ||
* ('21/12/2000') => 'DD/MM/YYYY' | ||
* ('12/21/2000') => 'DD/MM/YYYY' | ||
* ('2000-21-12') => ['YYYY-DD-MM', 'YYYY-MM-DD HH:mm:ss'] | ||
* ('21-12-2000') => ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
* ('21/12/2000 23:59:18') => ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
* ('2000/12/21') => null | ||
@@ -136,7 +135,7 @@ * ``` | ||
var getDateFormat = function (date) { | ||
var isValid = is(date, 'String') && date.trim().length === 10; | ||
var isValid = is(date, 'String') && date.trim().length >= 10; | ||
var format = !isValid ? null | ||
: /^\d{4}-\d{2}-\d{2}$/.test(date) ? 'YYYY-MM-DD' | ||
: /^\d{2}-\d{2}-\d{4}$/.test(date) ? 'DD-MM-YYYY' | ||
: /^\d{2}\/\d{2}\/\d{4}$/.test(date) ? 'DD/MM/YYYY' | ||
: /^\d{4}-\d{2}-\d{2}/.test(date) ? ['YYYY-MM-DD', 'YYYY-MM-DD HH:mm:ss'] | ||
: /^\d{2}-\d{2}-\d{4}/.test(date) ? ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
: /^\d{2}\/\d{2}\/\d{4}/.test(date) ? ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
: null; | ||
@@ -143,0 +142,0 @@ |
@@ -119,6 +119,5 @@ import moment from 'moment'; | ||
* @example ``` | ||
* ('2000-21-12') => 'YYYY-DD-MM' | ||
* ('21-12-2000') => 'DD-MM-YYYY' | ||
* ('21/12/2000') => 'DD/MM/YYYY' | ||
* ('12/21/2000') => 'DD/MM/YYYY' | ||
* ('2000-21-12') => ['YYYY-DD-MM', 'YYYY-MM-DD HH:mm:ss'] | ||
* ('21-12-2000') => ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
* ('21/12/2000 23:59:18') => ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
* ('2000/12/21') => null | ||
@@ -130,7 +129,7 @@ * ``` | ||
var getDateFormat = function (date) { | ||
var isValid = is(date, 'String') && date.trim().length === 10; | ||
var isValid = is(date, 'String') && date.trim().length >= 10; | ||
var format = !isValid ? null | ||
: /^\d{4}-\d{2}-\d{2}$/.test(date) ? 'YYYY-MM-DD' | ||
: /^\d{2}-\d{2}-\d{4}$/.test(date) ? 'DD-MM-YYYY' | ||
: /^\d{2}\/\d{2}\/\d{4}$/.test(date) ? 'DD/MM/YYYY' | ||
: /^\d{4}-\d{2}-\d{2}/.test(date) ? ['YYYY-MM-DD', 'YYYY-MM-DD HH:mm:ss'] | ||
: /^\d{2}-\d{2}-\d{4}/.test(date) ? ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
: /^\d{2}\/\d{2}\/\d{4}/.test(date) ? ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
: null; | ||
@@ -137,0 +136,0 @@ |
{ | ||
"name": "vue-convenia-util", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Plugin com validações, formatações e filtros para projetos Vue.", | ||
@@ -44,3 +44,2 @@ "keywords": [ | ||
"standard": { | ||
"env": "mocha", | ||
"ignore": [ | ||
@@ -47,0 +46,0 @@ "dist/vue-convenia-util.common.js", |
# Vue Convenia Util | ||
[![Build Status][0]][1] | ||
[![Build Status][badge-0]][link-0] | ||
[![JavaScript Style Guide][badge-1]][link-1] | ||
@@ -70,3 +71,8 @@ Plugin com validações, formatações e filtros para projetos Vue. Validação e | ||
[0]: https://travis-ci.org/convenia/vue-convenia-util.svg?branch=master | ||
[1]: https://travis-ci.org/convenia/vue-convenia-util | ||
<!-- Badges --> | ||
[badge-0]: https://travis-ci.org/convenia/vue-convenia-util.svg?branch=master | ||
[badge-1]: https://img.shields.io/badge/code_style-standard-brightgreen.svg | ||
<!-- Links --> | ||
[link-0]: https://travis-ci.org/convenia/vue-convenia-util | ||
[link-1]: https://standardjs.com |
@@ -6,6 +6,5 @@ import { is } from './validators' | ||
* @example ``` | ||
* ('2000-21-12') => 'YYYY-DD-MM' | ||
* ('21-12-2000') => 'DD-MM-YYYY' | ||
* ('21/12/2000') => 'DD/MM/YYYY' | ||
* ('12/21/2000') => 'DD/MM/YYYY' | ||
* ('2000-21-12') => ['YYYY-DD-MM', 'YYYY-MM-DD HH:mm:ss'] | ||
* ('21-12-2000') => ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
* ('21/12/2000 23:59:18') => ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
* ('2000/12/21') => null | ||
@@ -17,7 +16,7 @@ * ``` | ||
export const getDateFormat = (date) => { | ||
const isValid = is(date, 'String') && date.trim().length === 10 | ||
const isValid = is(date, 'String') && date.trim().length >= 10 | ||
const format = !isValid ? null | ||
: /^\d{4}-\d{2}-\d{2}$/.test(date) ? 'YYYY-MM-DD' | ||
: /^\d{2}-\d{2}-\d{4}$/.test(date) ? 'DD-MM-YYYY' | ||
: /^\d{2}\/\d{2}\/\d{4}$/.test(date) ? 'DD/MM/YYYY' | ||
: /^\d{4}-\d{2}-\d{2}/.test(date) ? ['YYYY-MM-DD', 'YYYY-MM-DD HH:mm:ss'] | ||
: /^\d{2}-\d{2}-\d{4}/.test(date) ? ['DD-MM-YYYY', 'DD-MM-YYYY HH:mm:ss'] | ||
: /^\d{2}\/\d{2}\/\d{4}/.test(date) ? ['DD/MM/YYYY', 'DD/MM/YYYY HH:mm:ss'] | ||
: null | ||
@@ -24,0 +23,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291854
78
1233