1.2.39 • Published 4 months ago

infordb v1.2.39

Weekly downloads
-
License
ISC
Repository
-
Last release
4 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="flex-between custom-date-picker-days">
                <div>ma</div>
                <div>di</div>
                <div>wo</div>
                <div>do</div>
                <div>vr</div>
                <div>za</div>
                <div>zo</div>
            </div>
            <div class="custom-date-picker">
                <div
                  *ngFor="let day of dateSelect.vars.completeDays"
                  [ngClass]="{
                    'active': dateSelect.vars.date.date === (dateSelect.vars.date.year + '-' + ('0' + dateSelect.vars.date.month).slice(-2) + '-' + ('0' + day.day).slice(-2)),
                    'prev-month': day.type === 'prev',
                    'current-month': day.type === 'current',
                    'next-month': day.type === 'next',
                    'disabled': day.status === 'past' //remove or change to 'future' or 'present' if needed
                  }"
                  (click)="dateSelect.confirmDate(day)">
                  {{ day.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.30

7 months ago

1.2.31

7 months ago

1.2.34

7 months ago

1.2.35

5 months ago

1.2.32

7 months ago

1.2.33

7 months ago

1.2.38

4 months ago

1.2.39

4 months ago

1.2.36

5 months ago

1.2.37

4 months ago

1.2.29

1 year ago

1.2.27

1 year ago

1.2.28

1 year ago

1.2.26

1 year ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.15

1 year ago

1.2.18

1 year ago

1.2.19

1 year ago

1.2.20

1 year ago

1.2.23

1 year ago

1.2.24

1 year ago

1.2.21

1 year ago

1.2.22

1 year ago

1.2.25

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.9

1 year ago

1.2.12

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.3

1 year ago

1.2.0

2 years ago

1.1.9

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.10

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago