1.2.29 • Published 2 months ago

infordb v1.2.29

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

InforDB NPM Module

Installation

$ npm i infordb

Update to the newest version

$ npm update infordb

Time select

Import time select variable

import { timeSelect } from 'infordb';

Define the variable as public

public timeSelect = timeSelect

HTML blade modal

  <div class="modal-container" *ngIf="timeSelect.modal" (click)="timeSelect.modal = false;" >
        <ion-card class="p-2 text-dark" style="width: 90vw; max-width: 750px;" (click)="$event.stopPropagation()" >
            <div class="d-flex ion-justify-content-around font-size-125">

                <div class="flex-between w-100" >
                    <div class="bg-secondary h-1 w-100 px-2"></div>
                </div>

                <!--      Hours-->
                <div (scroll)="timeSelect.scrollTime('hour')" style="max-height: 150px;" class="overflow-auto w-100" id="custom-time-hour" >
                    <div style="height: 39px" ></div>
                    <div class="ion-text-center my-4" id="custom-time-hour-{{h}}" *ngFor="let h of timeSelect.vars.hours" (click)="timeSelect.selectTimeValue('hour', h)" >
                        <span class="{{timeSelect.vars.time.hour == h ? 'text-primary' : ''}}" >{{('0'+h).slice(-2)}}</span>
                    </div>
                    <div style="height: 39px" ></div>
                </div>

                <div class="flex-between w-50" >
                    <div class="bg-secondary h-1 w-100 px-2"></div>
                </div>

                <!--      Minutes-->
                <div (scroll)="timeSelect.scrollTime('min')" style="max-height: 150px;" class="overflow-auto w-100" id="custom-time-min" >
                    <div style="height: 39px" ></div>
                    <div class="ion-text-center my-4" id="custom-time-min-{{m}}" *ngFor="let m of timeSelect.vars.minutes" (click)="timeSelect.selectTimeValue('min', m)">
                        <span class="{{timeSelect.vars.time.min == m ? 'text-primary' : ''}}" >{{('0'+m).slice(-2)}}</span>
                    </div>
                    <div style="height: 39px" ></div>
                </div>

                <div class="flex-between w-100" >
                    <div class="bg-secondary h-1 w-100 px-2"></div>
                </div>

            </div>
            <div class="mt-1 pt-1 ion-text-right border-top" >
                <ion-button fill="clear" (click)="timeSelect.confirmTime()" >OK</ion-button>
            </div>
        </ion-card>
    </div>

Usage

//variable[target] will be set to the selected time
timeSelect.select(variable, target)

Date select

Import time select variable

import { dateSelect } from 'infordb';

Define the variable as public

public dateSelect = dateSelect

HTML blade modal

<div class="modal-container" *ngIf="dateSelect.modal" (click)="dateSelect.modal = false;" >
        <ion-card class="p-2 text-dark" style="width: 90vw; max-width: 650px;" (click)="$event.stopPropagation()" >

            <div class="flex-between my-1 mx--2">
                <ion-button fill="clear" class="mx-2" (click)="dateSelect.selectDateChangeYear(false)" ><ion-icon name="chevron-back-outline"></ion-icon></ion-button>
                <span class="mx-2" >{{dateSelect.vars.date.year}}</span>
                <ion-button fill="clear" class="mx-2" (click)="dateSelect.selectDateChangeYear(true)" ><ion-icon name="chevron-forward-outline"></ion-icon></ion-button>
            </div>

            <div class="flex-between my-1 mx--2">
                <ion-button fill="clear" class="mx-2" (click)="dateSelect.selectDateChangeMonth(false)" ><ion-icon name="chevron-back-outline"></ion-icon></ion-button>
                <span class="mx-2" >{{dateSelect.vars.months[dateSelect.vars.date.month]}}</span>
                <ion-button fill="clear" class="mx-2" (click)="dateSelect.selectDateChangeMonth(true)" ><ion-icon name="chevron-forward-outline"></ion-icon></ion-button>
            </div>

            <div class="custom-date-picker">
                <div [ngClass]="dateSelect.vars.date.date == (dateSelect.vars.date.year+'-'+('0'+dateSelect.vars.date.month).slice(-2)+'-'+('0'+day).slice(-2)) ? 'active' : ''" (click)="dateSelect.confirmDate(day)" *ngFor="let day of dateSelect.vars.date.days" >{{day}}</div>
            </div>

        </ion-card>
    </div>

Usage

//variable[target] will be set to the selected time
dateSelect.select(variable, target)

CSS

/main.css must be copied to the project

Now()

Import and define as public if needed

import { now } from 'infordb';
...
public now = now

Usage

now().date.eu   // 31-12-2022
now().date.us   // 2022-12-31
now().time      // 10:15
now().timestamp // 1673339350591 

Date convertsion()

Import and define as public if needed

import { convertDate } from 'infordb';
...
public convertDate = convertDate

Usage

convertDate('2022-12-31 10:15').date     // 31-12-2022
convertDate('2022-12-31 10:15').reverse  // 2022-12-31
1.2.29

2 months ago

1.2.27

2 months ago

1.2.28

2 months ago

1.2.26

2 months ago

1.2.16

2 months ago

1.2.17

2 months ago

1.2.15

2 months ago

1.2.18

2 months ago

1.2.19

2 months ago

1.2.20

2 months ago

1.2.23

2 months ago

1.2.24

2 months ago

1.2.21

2 months ago

1.2.22

2 months ago

1.2.25

2 months ago

1.2.14

2 months ago

1.2.13

2 months ago

1.2.8

2 months ago

1.2.7

2 months ago

1.2.6

2 months ago

1.2.5

2 months ago

1.2.4

2 months ago

1.2.9

2 months ago

1.2.12

2 months ago

1.2.10

2 months ago

1.2.11

2 months ago

1.2.3

4 months ago

1.2.0

1 year ago

1.1.9

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.10

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago