├── .eslintignore
├── .eslintrc.yml
├── .gitattributes
├── .github
├── CONTRIBUTING.md
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ ├── config.yml
│ └── image.png
├── PULL_REQUEST_TEMPLATE
└── workflows
│ ├── base
│ └── action.yaml
│ ├── build
│ └── action.yaml
│ ├── codeql-analysis.yml
│ ├── docs.yaml
│ ├── docs
│ └── action.yaml
│ ├── feature-branch.yaml
│ ├── nuget.yml
│ ├── nuget
│ └── action.yaml
│ ├── pr.yml
│ ├── publish.yml
│ ├── release
│ └── action.yaml
│ └── stale.yaml
├── .gitignore
├── .husky
└── pre-commit
├── .npmignore
├── .prettierignore
├── .prettierrc
├── CNAME
├── LICENSE
├── README.md
├── build
├── banner.js
├── change-version.js
├── plugins.js
├── rollup-plugin.config.js
├── rollup.config.js
├── serve.js
└── utilities.js
├── package-lock.json
├── package.json
├── sonar-project.properties
├── src
├── docs
│ ├── assets
│ │ ├── 24hour.png
│ │ ├── buttons.png
│ │ ├── calendar-view.png
│ │ ├── calendar-weeks.png
│ │ ├── date-range.png
│ │ ├── decade-view.png
│ │ ├── metronic-thumb-1.png
│ │ ├── metronic-thumb-2.png
│ │ ├── metronic-thumb-3.png
│ │ ├── month-view.png
│ │ ├── no-styles.html
│ │ ├── repl-data.json
│ │ ├── side-by-side.png
│ │ ├── time-view.png
│ │ ├── toolbar.png
│ │ └── year-view.png
│ ├── js
│ │ ├── docs.js
│ │ └── migration.js
│ ├── make.js
│ ├── partials
│ │ ├── change-log-archive.html
│ │ ├── change-log.html
│ │ ├── datetime.html
│ │ ├── examples
│ │ │ ├── index.html
│ │ │ └── jquery.html
│ │ ├── functions.html
│ │ ├── functions
│ │ │ ├── dates.html
│ │ │ ├── display.html
│ │ │ └── index.html
│ │ ├── index.html
│ │ ├── installing.html
│ │ ├── locale.html
│ │ ├── migration.html
│ │ ├── namespace
│ │ │ ├── css.html
│ │ │ ├── errors.html
│ │ │ ├── events.html
│ │ │ ├── index.html
│ │ │ └── unit.html
│ │ ├── options.html
│ │ ├── options
│ │ │ ├── display.html
│ │ │ ├── index.html
│ │ │ ├── keyboard-navigation.html
│ │ │ ├── localization.html
│ │ │ └── restrictions.html
│ │ ├── plugins
│ │ │ ├── bi1.html
│ │ │ ├── customDateFormat.html
│ │ │ ├── fa5.html
│ │ │ ├── floating-ui.html
│ │ │ ├── index.html
│ │ │ ├── moment.html
│ │ │ └── paint.html
│ │ └── repl.html
│ ├── site-config.json
│ ├── styles
│ │ ├── bs5_docs.scss
│ │ └── styles.scss
│ └── templates
│ │ ├── 404.html
│ │ ├── index.html
│ │ ├── page-template.html
│ │ ├── post-loop.html
│ │ └── shell.html
├── js
│ ├── actions.ts
│ ├── dates.ts
│ ├── datetime.ts
│ ├── display
│ │ ├── calendar
│ │ │ ├── date-display.ts
│ │ │ ├── decade-display.ts
│ │ │ ├── month-display.ts
│ │ │ └── year-display.ts
│ │ ├── collapse.ts
│ │ ├── index.ts
│ │ └── time
│ │ │ ├── hour-display.ts
│ │ │ ├── minute-display.ts
│ │ │ ├── second-display.ts
│ │ │ └── time-display.ts
│ ├── jQuery-provider.js
│ ├── locales
│ │ ├── ar-SA.ts
│ │ ├── ar.ts
│ │ ├── ca.ts
│ │ ├── cs.ts
│ │ ├── de.ts
│ │ ├── es.ts
│ │ ├── fi.ts
│ │ ├── fr.ts
│ │ ├── hr.ts
│ │ ├── hy.ts
│ │ ├── it.ts
│ │ ├── nl.ts
│ │ ├── pl.ts
│ │ ├── pt-PT.ts
│ │ ├── ro.ts
│ │ ├── ru.ts
│ │ ├── sk.ts
│ │ ├── sl.ts
│ │ ├── sr-Latn.ts
│ │ ├── sr.ts
│ │ ├── tr.ts
│ │ ├── uk.ts
│ │ ├── zh-CN.ts
│ │ ├── zh-HK.ts
│ │ ├── zh-MO.ts
│ │ └── zh-TW.ts
│ ├── plugins
│ │ ├── bi-one
│ │ │ └── index.ts
│ │ ├── customDateFormat
│ │ │ └── index.ts
│ │ ├── examples
│ │ │ ├── custom-paint-job.ts
│ │ │ └── sample.ts
│ │ ├── fa-five
│ │ │ └── index.ts
│ │ └── moment-parse
│ │ │ └── index.ts
│ ├── tempus-dominus.ts
│ ├── utilities
│ │ ├── action-types.ts
│ │ ├── calendar-modes.ts
│ │ ├── default-format-localization.ts
│ │ ├── default-options.ts
│ │ ├── errors.ts
│ │ ├── event-emitter.ts
│ │ ├── event-types.ts
│ │ ├── namespace.ts
│ │ ├── optionConverter.ts
│ │ ├── optionProcessor.ts
│ │ ├── options.ts
│ │ ├── optionsStore.ts
│ │ ├── service-locator.ts
│ │ ├── typeChecker.ts
│ │ └── view-mode.ts
│ └── validation.ts
├── nuget
│ ├── TempusDominus.nuspec
│ ├── TempusDominus.scss.nuspec
│ └── td.png
└── scss
│ ├── _variables.scss
│ └── tempus-dominus.scss
├── td logo.png
├── td logo.xcf
├── test
├── actions.test.ts
├── dates.test.ts
├── datetime.test.ts
├── fixtures
│ ├── dates.fixture.ts
│ ├── display.fixture.ts
│ ├── eventemitters.fixture.ts
│ ├── optionStore.fixture.ts
│ ├── serviceLocator.fixture.ts
│ └── validation.fixture.ts
├── tempus-dominus.test.ts
├── test-import.ts
├── test-utilities.ts
├── utilities
│ ├── optionProccessor.test.ts
│ ├── optionStore.test.ts
│ ├── serviceLocator.test.ts
│ └── typeCechker.test.ts
└── validation.test.ts
├── tsconfig.json
└── vite.config.ts
/.eslintignore:
--------------------------------------------------------------------------------
1 | **/dist/
2 | **/docs/
3 | **/coverage/
4 | **/.husky/
5 | **/types/
6 | **/build/
7 | **/test/
8 |
--------------------------------------------------------------------------------
/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | env:
2 | browser: true
3 | es2021: true
4 | extends:
5 | - eslint:recommended
6 | - plugin:@typescript-eslint/recommended
7 | - prettier
8 | overrides: []
9 | parser: '@typescript-eslint/parser'
10 | parserOptions:
11 | ecmaVersion: latest
12 | sourceType: module
13 | plugins:
14 | - '@typescript-eslint'
15 | rules:
16 | linebreak-style:
17 | - error
18 | - unix
19 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Submitting Issues
2 |
3 | If you are submitting a bug, please test and/or fork [this StackBlitz](https://stackblitz.com/edit/tempus-dominus-v6-simple-setup) demonstrating the issue. Code issues and fringe case bugs that do not include a StackBlitz (or similar) will be closed.
4 |
5 | Issues that are submitted without a description (title only) will be closed with no further explanation.
6 |
7 | # Contributing code
8 |
9 | To contribute, fork the library and run `npm install`. You need [node](http://nodejs.org/); use [nvm](https://github.com/creationix/nvm) or [nenv](https://github.com/ryuone/nenv) to install it.
10 |
11 | ```bash
12 | git https://github.com/Eonasdan/tempus-dominus.git
13 | cd tempus-dominus
14 | npm i
15 | git checkout development # all patches against development branch, please!
16 | ```
17 |
18 | # Very important notes
19 |
20 | **Pull requests to the `master` branch will be closed.** Please submit all pull requests to the `development` branch.
21 | - **Do not include the minified files in your pull request.** Don't worry, we'll build them when we cut a release.
22 | - Pull requests that do not include a description (title only) and the following will be closed:
23 | - What the change does
24 | - A use case (for new features or enhancements)
25 |
26 | # NPM Scripts
27 |
28 |
29 | | Script | Description |
30 | |--------|------------|
31 | | start | Launches browser sync and watches for files changes.|
32 | | serve | Launches browser sync to serve the docs. |
33 | | build | Creates compiled js, css and copies the extra files to the dist folder. |
34 | | sass | Compiles just the sass files to css. |
35 | | rollup | Compiles typescript and scss files. |
36 | | rollup-watch | Same as above but watches for changes and compiles as needed. |
37 | | build:declarations | Builds the typescript definition files. |
38 | | prettier | Runs prettier to format the code. |
39 | | docs | Builds the docs. |
40 | | docs-watch | Watches for changes to the docs files. |
41 | | release-version | Creates a new release version. |
42 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: eonasdan
4 | ko_fi: eonasdan
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Report a bug
2 | description: Tell us about your issue.
3 | title: "Provide a general summary of the issue"
4 | labels: ["Type: Bug", "State: Unsponsored"]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: "
Note: I am no longer taking feature requests.
9 | Beginning in 2024, tickets will be paid support only. Please see [this discussion](https://github.com/Eonasdan/tempus-dominus/discussions/2694).
"
10 | - type: checkboxes
11 | attributes:
12 | label: Prerequisites
13 | description: Take a couple minutes to help our maintainers work faster.
14 | options:
15 | - label: I have [searched](https://github.com/Eonasdan/tempus-dominus/issues?q=is%3Aissue) for duplicate or closed issues.
16 | required: true
17 | - label: I have validated my setup against the latest version on [StackBlitz](https://stackblitz.com/edit/tempus-dominus-v6-simple-setup).
18 | required: true
19 | - label: I have read the [contributing guidelines](https://github.com/Eonasdan/tempus-dominus/blob/master/.github/CONTRIBUTING.md).
20 | required: true
21 | - label: I understand that only sponsored issues will be worked on and that if I wish to sponsor an issue, I will contact the owner FIRST.
22 | required: true
23 | - type: textarea
24 | id: what-happened
25 | attributes:
26 | label: Describe the issue
27 | description: Provide a summary of the issue and what you expected to happen, including specific steps to reproduce.
28 | validations:
29 | required: true
30 | - type: markdown
31 | attributes:
32 | value: ""
33 | - type: textarea
34 | id: reduced-test-case
35 | attributes:
36 | label: StackBlitz fork
37 | description: "You MUST provide an StackBlitz fork of one of the following examples: [HTML](https://stackblitz.com/edit/tempus-dominus-v6-simple-setup), [Typescript](https://stackblitz.com/edit/v6-typescript), [Using import](https://stackblitz.com/edit/tempus-dominus-v6-simple-setup-import), or [jQuery](https://stackblitz.com/edit/tempus-dominus-v6-simple-jquery-setup)."
38 | validations:
39 | required: true
40 | - type: dropdown
41 | id: os
42 | attributes:
43 | label: What operating system(s) are you seeing the problem on?
44 | multiple: true
45 | options:
46 | - Windows
47 | - macOS
48 | - Android
49 | - iOS
50 | - Linux
51 | validations:
52 | required: true
53 | - type: dropdown
54 | id: browser
55 | attributes:
56 | label: What browser(s) are you seeing the problem on?
57 | multiple: true
58 | options:
59 | - Chrome
60 | - Safari
61 | - Firefox
62 | - Microsoft Edge
63 | - Opera
64 | - type: input
65 | id: version
66 | attributes:
67 | label: What version of are you using? You can find this information from the sample StackBlitz.
68 | placeholder: "e.g., v5.1.0 or v4.5.2"
69 | validations:
70 | required: true
71 | - type: input
72 | id: locale
73 | attributes:
74 | label: What your browser's locale? You can find this information from the sample StackBlitz.
75 | placeholder: "e.g., 'en-US'"
76 | validations:
77 | required: true
78 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | contact_links:
2 | - name: Ask a question
3 | url: https://github.com/Eonasdan/tempus-dominus/discussions/new
4 | about: Ask and discuss questions with other community members
5 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/.github/ISSUE_TEMPLATE/image.png
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE:
--------------------------------------------------------------------------------
1 | PRs relating to the v4 will be closed and locked.
2 |
3 | * **Please check if the PR fulfills these requirements**
4 | - [ ] Tests for the changes have been added (for bug fixes / features)
5 | - [ ] Docs have been added / updated (for bug fixes / features)
6 |
7 |
8 | * **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...). If this is a fix, please tag a bug.
9 |
10 |
11 |
12 | * **What is the current behavior?** (You can also link to an open issue here)
13 |
14 |
15 |
16 | * **What is the new behavior (if this is a feature change)?**
17 |
18 |
19 |
20 | * **Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?)
21 |
22 |
23 |
24 | * **Other information**:
25 |
--------------------------------------------------------------------------------
/.github/workflows/base/action.yaml:
--------------------------------------------------------------------------------
1 | name: Setup Node
2 | description: Setup node
3 |
4 | inputs:
5 | registry:
6 | description: 'A Github PAT'
7 | default: 'https://registry.npmjs.org'
8 |
9 | runs:
10 | using: composite
11 | steps:
12 | - name: Setup Node
13 | uses: actions/setup-node@v3
14 | with:
15 | node-version: '18'
16 | registry-url: ${{ inputs.registry }}
17 | - name: Npm install
18 | shell: bash
19 | run: npm ci
20 |
--------------------------------------------------------------------------------
/.github/workflows/build/action.yaml:
--------------------------------------------------------------------------------
1 | name: Build
2 | description: Build
3 |
4 | inputs:
5 | GITHUB_TOKEN:
6 | description: 'A Github PAT'
7 | required: true
8 | SONAR_TOKEN:
9 | description: 'A Sonar token'
10 | required: true
11 |
12 | runs:
13 | using: composite
14 | steps:
15 | - name: Unit tests
16 | shell: bash
17 | run: npm run test:coverage
18 | - name: Build
19 | shell: bash
20 | run: npm run build
21 | - name: Build docs
22 | shell: bash
23 | run: npm run docs
24 | - name: SonarCloud Scan
25 | uses: sonarsource/sonarcloud-github-action@master
26 | env:
27 | GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
28 | SONAR_TOKEN: ${{ inputs.SONAR_TOKEN }}
29 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ master ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ master ]
20 | schedule:
21 | - cron: '16 12 * * 1'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'javascript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support
38 |
39 | steps:
40 | - name: Checkout repository
41 | uses: actions/checkout@v3
42 |
43 | # Initializes the CodeQL tools for scanning.
44 | - name: Initialize CodeQL
45 | uses: github/codeql-action/init@v2
46 | with:
47 | languages: ${{ matrix.language }}
48 | # If you wish to specify custom queries, you can do so here or in a config file.
49 | # By default, queries listed here will override any specified in a config file.
50 | # Prefix the list here with "+" to use these queries and those in the config file.
51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
52 |
53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54 | # If this step fails, then you should remove it and run the build manually (see below)
55 | - name: Autobuild
56 | uses: github/codeql-action/autobuild@v2
57 |
58 | # ℹ️ Command-line programs to run using the OS shell.
59 | # 📚 https://git.io/JvXDl
60 |
61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62 | # and modify them (or add more) to build your code if your project
63 | # uses a compiled language
64 |
65 | #- run: |
66 | # make bootstrap
67 | # make release
68 |
69 | - name: Perform CodeQL Analysis
70 | uses: github/codeql-action/analyze@v2
71 |
--------------------------------------------------------------------------------
/.github/workflows/docs.yaml:
--------------------------------------------------------------------------------
1 | name: Publish Docs
2 | on:
3 | workflow_dispatch:
4 | jobs:
5 | docs:
6 | runs-on: ubuntu-latest
7 | steps:
8 | - name: Checkout
9 | uses: actions/checkout@v3
10 | - name: Setup
11 | uses: ./.github/workflows/base
12 | - name: Build
13 | uses: ./.github/workflows/build
14 | with:
15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 | - name: Deploy Docs
18 | uses: ./.github/workflows/docs
19 | with:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/docs/action.yaml:
--------------------------------------------------------------------------------
1 | name: Deploy Docs
2 |
3 | inputs:
4 | GITHUB_TOKEN:
5 | description: 'A Github PAT'
6 | required: true
7 |
8 | runs:
9 | using: composite
10 | steps:
11 | - name: Deploy Docs
12 | uses: peaceiris/actions-gh-pages@v3
13 | with:
14 | github_token: ${{ inputs.GITHUB_TOKEN }}
15 | publish_dir: ./docs
16 | keep_files: true
17 |
--------------------------------------------------------------------------------
/.github/workflows/feature-branch.yaml:
--------------------------------------------------------------------------------
1 | name: Feature Branch Publish Package
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'feature/*'
7 | - 'bug/*'
8 | - development
9 | paths:
10 | - src/js
11 |
12 | jobs:
13 | main:
14 | runs-on: ubuntu-latest
15 | permissions:
16 | contents: read
17 | packages: write
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v3
21 | - name: Setup
22 | uses: ./.github/workflows/base
23 | - name: Set package version
24 | id: set_version
25 | run: |
26 | # Get the branch name
27 | BRANCH_NAME=${GITHUB_REF#refs/heads/}
28 | # remove "feature/" prefix
29 | BRANCH_NAME=${BRANCH_NAME#feature/}
30 | # replace underscore with dashes (thanks semver)
31 | BRANCH_NAME=${BRANCH_NAME//_/-}
32 | BUILD_ID=$(echo $GITHUB_RUN_ID | cut -c1-7)
33 | VERSION=$(node -p "const pkg = require('./package.json'); pkg.version")
34 | NEW_VERSION="$VERSION-$BRANCH_NAME.$BUILD_ID"
35 | #sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/g" ./package.json
36 | echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
37 | echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
38 | - name: Build
39 | uses: ./.github/workflows/build
40 | with:
41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43 | - name: Create Release
44 | run: npm run release:version ${{steps.set_version.outputs.VERSION }} ${{steps.set_version.outputs.NEW_VERSION }}
45 | - name: Create Tag
46 | uses: actions/github-script@v6
47 | with:
48 | script: |
49 | const {DIST_VERSION} = process.env
50 | github.rest.git.createRef({
51 | owner: context.repo.owner,
52 | repo: context.repo.repo,
53 | ref: `refs/tags/${{steps.set_version.outputs.NEW_VERSION }}`,
54 | sha: context.sha
55 | })
56 |
--------------------------------------------------------------------------------
/.github/workflows/nuget.yml:
--------------------------------------------------------------------------------
1 | name: Publish Nuget
2 | on:
3 | workflow_dispatch:
4 | jobs:
5 | build:
6 | runs-on: windows-latest
7 | steps:
8 | - name: Checkout
9 | uses: actions/checkout@v3
10 | - name: Setup
11 | uses: ./.github/workflows/base
12 | - name: Build
13 | uses: ./.github/workflows/build
14 | with:
15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 | - name: Nuget
18 | uses: ./.github/workflows/nuget
19 | with:
20 | NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
21 |
--------------------------------------------------------------------------------
/.github/workflows/nuget/action.yaml:
--------------------------------------------------------------------------------
1 | name: Nuget Publish
2 | description: Setup node
3 |
4 | inputs:
5 | NUGET_API_KEY:
6 | description: 'A Nuget API Key'
7 | required: true
8 |
9 | runs:
10 | using: composite
11 | steps:
12 | - name: Setup NuGet
13 | uses: NuGet/setup-nuget@v2
14 | - name: Pack NuGet
15 | working-directory: ./src/nuget
16 | shell: pwsh
17 | run: |
18 | nuget pack TempusDominus.nuspec -Verbosity detailed -NonInteractive -NoPackageAnalysis
19 | nuget pack TempusDominus.scss.nuspec -Verbosity detailed -NonInteractive -NoPackageAnalysis
20 | - name: Push Nuget
21 | working-directory: ./src/nuget
22 | shell: pwsh
23 | run: |
24 | nuget push TempusDominus.*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ inputs.NUGET_API_KEY }}
25 | nuget push TempusDominus.scss.*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ inputs.NUGET_API_KEY }}
26 |
--------------------------------------------------------------------------------
/.github/workflows/pr.yml:
--------------------------------------------------------------------------------
1 | name: Pull Request
2 | on:
3 | push:
4 | branches: [ development ]
5 | pull_request:
6 | branches: [ development ]
7 | workflow_dispatch:
8 | jobs:
9 | pr:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v3
14 | with:
15 | fetch-depth: 0
16 | - name: Setup
17 | uses: ./.github/workflows/base
18 | - name: Build
19 | uses: ./.github/workflows/build
20 | with:
21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
23 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish Package
2 | on:
3 | release:
4 | types: [ created ]
5 | workflow_dispatch:
6 | jobs:
7 | publish:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout
11 | uses: actions/checkout@v3
12 | - name: Setup
13 | uses: ./.github/workflows/base
14 | - name: Release
15 | uses: ./.github/workflows/release
16 | with:
17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
19 | VERSION: ${{ github.event.release.tag_name }}
20 | - name: Deploy Docs
21 | uses: ./.github/workflows/docs
22 | with:
23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 | - run: npm publish --access=public
25 | env:
26 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27 | #nuget on linux is broken
28 | # - name: Nuget
29 | # uses: ./.github/workflows/nuget
30 | # with:
31 | # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
32 |
--------------------------------------------------------------------------------
/.github/workflows/release/action.yaml:
--------------------------------------------------------------------------------
1 | name: Release
2 | description: Release
3 |
4 | inputs:
5 | GITHUB_TOKEN:
6 | description: 'A Github PAT'
7 | required: true
8 | SONAR_TOKEN:
9 | description: 'A Sonar token'
10 | required: true
11 | VERSION:
12 | description: 'Version number'
13 | required: true
14 |
15 | runs:
16 | using: composite
17 | steps:
18 | - name: Build
19 | shell: bash
20 | run: npm run release
21 | - name: Create new release
22 | shell: bash
23 | run: npm run version ${{ inputs.VERSION }}
24 | # - name: SonarCloud Scan
25 | # uses: sonarsource/sonarcloud-github-action@master
26 | # env:
27 | # GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
28 | # SONAR_TOKEN: ${{ inputs.SONAR_TOKEN }}
29 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yaml:
--------------------------------------------------------------------------------
1 | name: 'Close stale issues and PRs'
2 | on:
3 | schedule:
4 | - cron: '30 1 * * *' #at 1:30 pm
5 |
6 | jobs:
7 | stale:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/stale@v7
11 | with:
12 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
13 | stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
14 | any-of-labels: 'State: Waiting feedback'
15 | stale-issue-label: 'State: Stale'
16 | stale-pr-label: 'State: Stale'
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bower_components
2 | node_modules
3 | .idea
4 | .vs
5 | obj
6 | bin
7 | site
8 | *.user
9 | *.csproj
10 | *.sln
11 | *.nupkg
12 | src/docs/partials/examples/test.html
13 | src/docs/assets/carbon.css
14 | src/docs/assets/site.webmanifest
15 | /docs/
16 | /dist/plugins/examples/
17 | coverage
18 | dist
19 | types
20 |
21 | .DS_Store
22 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | . "$(dirname -- "$0")/_/husky.sh"
3 |
4 | npx lint-staged
5 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /assets
2 | /_includes
3 | /_layouts
4 | /.gitignore
5 | /node_modules
6 | /test
7 | *.log
8 | *.swp
9 | *~
10 | *.tgz
11 | /site
12 | *.user
13 | *.csproj
14 | *.sln
15 | *.nupkg
16 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist
2 | docs
3 | node_modules
4 | .github
5 | coverage
6 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "tabWidth": 2,
4 | "htmlWhitespaceSensitivity": "ignore",
5 | "endOfLine": "lf"
6 | }
7 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | getdatepicker.com
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2021 Jonathan Peterson (@Eonasdan)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://ko-fi.com/R6R53OEFF)
2 |
3 | # Paid support only
4 |
5 | Please note that I'm moving on to other projects. New issues will need to be sponsored. This can be done via BountySource or my other donation links. Please reach out to me first so we can discuss the terms. Thank you for your years of support.
6 |
7 | # Tempus Dominus Date/Time Picker v6.9.4
8 |
9 | Tempus Dominus is a powerful and robust date time picker for javascript. Version 6 is another major rewrite over the previous version. V6 is written with modern browsers in mind and is written in typescript. Bootstrap, momentjs and jQuery are no longer required dependencies. Popper2 is all that is required for the picker to position correctly. If you still require jQuery (seriously, you should move off that asap) there's a jQuery provider that wraps the native js functions.
10 |
11 | # Developers
12 |
13 | ## Building
14 |
15 | Run `npm i` to install needed packages.
16 |
17 | The docs folder contains the generated documentation site, don't modify this directly as it will be overwritten on build. The dist folder contains the built js/css files.
18 |
19 | ## Running
20 |
21 | You can run `npm run serve` which will start a web server. Navigate to `http://localhost:3001/` to view the docs.
22 |
23 | ## Watching for changes
24 |
25 | Do not run `npm run serve` at the same time.
26 |
27 | Run `npm start`. This runs web server, the build and watchers for the docs, styles, and typescript.
28 |
29 | ## Where do you use this?
30 |
31 | I'd love to know if your public site is using this plugin and list your logo on the documentation site. Leave [create a discussion](https://github.com/Eonasdan/tempus-dominus/discussions/categories/show-your-love) and let me know.
32 |
33 | ## Priority support is available at an hourly rate.
34 |
35 | If you have an urgent request, bug or need installation help, please contact in the discord server.
36 |
--------------------------------------------------------------------------------
/build/banner.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const pkg = require('../package.json');
4 | const year = new Date().getFullYear();
5 |
6 | function getBanner() {
7 | return `/*!
8 | * Tempus Dominus v${pkg.version} (${pkg.homepage})
9 | * Copyright 2013-${year} ${pkg.author.name}
10 | * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
11 | */`;
12 | }
13 |
14 | module.exports = getBanner;
15 |
--------------------------------------------------------------------------------
/build/change-version.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const path = require('path');
3 | const globby = require('globby');
4 |
5 | // Function to update version in a file
6 | function updateVersionInFile(filePath, oldVersion, newVersion) {
7 | try {
8 | const content = fs.readFileSync(filePath, 'utf8');
9 | const updated = content.replace(
10 | new RegExp(oldVersion.replace(/\./g, '\\.'), 'g'),
11 | newVersion
12 | );
13 |
14 | if (content !== updated) {
15 | fs.writeFileSync(filePath, updated, 'utf8');
16 | console.log(`Updated version in ${filePath}`);
17 | }
18 | } catch (error) {
19 | console.error(`Error processing ${filePath}:`, error);
20 | }
21 | }
22 |
23 | async function updateVersions(newVersion) {
24 | try {
25 | // Read current version from package.json
26 | const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
27 | const currentVersion = packageJson.version;
28 |
29 | if (!currentVersion) {
30 | throw new Error('Could not find version in package.json');
31 | }
32 |
33 | // Update package.json
34 | packageJson.version = newVersion;
35 | fs.writeFileSync(
36 | './package.json',
37 | JSON.stringify(packageJson, null, 2) + '\n'
38 | );
39 | console.log('Updated version in package.json');
40 |
41 | const GLOB = [
42 | '**/*.{json,md,nuspec,properties}',
43 | 'src/js/tempus-dominus.ts',
44 | '**/shell.html',
45 | '**/installing.html',
46 | '**/templates/index.html',
47 | '!**/change-log*',
48 | '!test/**/*',
49 | ];
50 |
51 | const GLOBBY_OPTIONS = {
52 | cwd: path.join(__dirname, '..'),
53 | gitignore: true,
54 | };
55 |
56 | const files = await globby(GLOB, GLOBBY_OPTIONS);
57 |
58 | //make sure that the dist folder is included
59 | files.push(
60 | ...(await globby(['dist/**/*'], {
61 | cwd: path.join(__dirname, '..'),
62 | }))
63 | );
64 |
65 | // Update version in each file
66 | for (const file of files) {
67 | updateVersionInFile(file, currentVersion, newVersion);
68 | }
69 | } catch (error) {
70 | console.error('Error:', error);
71 | process.exit(1);
72 | }
73 | }
74 |
75 | // Get new version from command line argument
76 | const newVersion = process.argv[2];
77 |
78 | if (!newVersion) {
79 | console.error('Please provide a new version number as an argument');
80 | console.error('Usage: node update-version.js ');
81 | process.exit(1);
82 | }
83 |
84 | // Execute the update
85 | updateVersions(newVersion);
86 |
--------------------------------------------------------------------------------
/build/plugins.js:
--------------------------------------------------------------------------------
1 | const rollup = require('rollup');
2 | const genericRollup = require('./rollup-plugin.config');
3 | const fs = require('fs').promises;
4 | const path = require('path');
5 |
6 | const formatName = (n) => n.replace(/\.ts/, '').replace(/-/g, '_');
7 |
8 | const localePath = path.join(__dirname, '../src/js/locales');
9 |
10 | async function build(option) {
11 | const bundle = await rollup.rollup(option.input);
12 | await bundle.write(option.output);
13 | }
14 |
15 | async function locales() {
16 | console.log('Building Locales...');
17 | try {
18 | /* eslint-disable no-restricted-syntax, no-await-in-loop */
19 | // We use await-in-loop to make rollup run sequentially to save on RAM
20 | const locales = await fs.readdir(localePath);
21 | for (const l of locales.filter((x) => x.endsWith('.ts'))) {
22 | // run builds sequentially to limit RAM usage
23 | await build(
24 | genericRollup({
25 | input: `./src/js/locales/${l}`,
26 | fileName: `./dist/locales/${l.replace('.ts', '.js')}`,
27 | name: `tempusDominus.locales.${formatName(l)}`,
28 | kind: 'locales',
29 | })
30 | );
31 | }
32 | } catch (e) {
33 | console.error(e); // eslint-disable-line no-console
34 | }
35 | }
36 |
37 | async function plugins() {
38 | console.log('Building Plugins...');
39 | try {
40 | const plugins = await fs.readdir(path.join(__dirname, '../src/js/plugins'));
41 | for (const plugin of plugins.filter((x) => x !== 'examples')) {
42 | // run builds sequentially to limit RAM usage
43 | await build(
44 | genericRollup({
45 | input: `./src/js/plugins/${plugin}/index.ts`,
46 | fileName: `./dist/plugins/${plugin}.js`,
47 | name: `tempusDominus.plugins.${formatName(plugin)}`,
48 | kind: 'plugins',
49 | })
50 | );
51 | }
52 |
53 | const examplePlugins = await fs.readdir(
54 | path.join(__dirname, '../src/js/plugins/examples')
55 | );
56 | for (const plugin of examplePlugins.map((x) => x.replace('.ts', ''))) {
57 | // run builds sequentially to limit RAM usage
58 | await build(
59 | genericRollup({
60 | input: `./src/js/plugins/examples/${plugin}.ts`,
61 | fileName: `./dist/plugins/examples/${plugin}.js`,
62 | name: `tempusDominus.plugins.${formatName(plugin)}`,
63 | })
64 | );
65 | }
66 | } catch (e) {
67 | console.error(e); // eslint-disable-line no-console
68 | }
69 | }
70 |
71 | const args = process.argv.slice(2);
72 |
73 | let command = 'all';
74 |
75 | if (args.length !== 0) command = args[0];
76 |
77 | switch (command) {
78 | case '-p':
79 | plugins().then();
80 | break;
81 | case '-l':
82 | locales().then();
83 | break;
84 | case 'all':
85 | plugins().then(() => locales().then());
86 | break;
87 | }
88 |
--------------------------------------------------------------------------------
/build/rollup-plugin.config.js:
--------------------------------------------------------------------------------
1 | const typescript = require('rollup-plugin-ts');
2 | const ignore = require('rollup-plugin-ignore');
3 |
4 | const banner = require('./banner.js');
5 | const globals = {
6 | '@popperjs/core': 'Popper',
7 | tempusDominus: 'tempusDominus',
8 | };
9 |
10 | module.exports = (config) => {
11 | const { input, fileName, name, kind } = config;
12 | return {
13 | input: {
14 | input,
15 | external: ['tempusDominus'],
16 | plugins: [
17 | ignore(['DateTime', 'ErrorMessages', 'FormatLocalization']),
18 | typescript({
19 | tsconfig: (resolvedConfig) => ({
20 | ...resolvedConfig,
21 | declaration: kind !== undefined,
22 | declarationDir: `./types/${kind}`,
23 | }),
24 | }),
25 | ],
26 | },
27 | output: {
28 | banner,
29 | file: fileName,
30 | format: 'umd',
31 | name: name || 'tempusDominus',
32 | globals,
33 | compact: true,
34 | },
35 | };
36 | };
37 |
--------------------------------------------------------------------------------
/build/rollup.config.js:
--------------------------------------------------------------------------------
1 | const typescript = require('rollup-plugin-ts');
2 | import postcss from 'rollup-plugin-postcss';
3 | import { terser } from 'rollup-plugin-terser';
4 |
5 | const pkg = require('../package.json');
6 | const banner = require('./banner.js');
7 |
8 | const globals = {
9 | '@popperjs/core': 'Popper',
10 | };
11 |
12 | export default [
13 | {
14 | input: 'src/js/tempus-dominus.ts',
15 | output: [
16 | {
17 | banner,
18 | file: pkg.main,
19 | format: 'umd',
20 | name: 'tempusDominus',
21 | sourcemap: true,
22 | globals,
23 | },
24 | {
25 | banner,
26 | file: pkg.module,
27 | format: 'es',
28 | name: 'tempusDominus',
29 | sourcemap: true,
30 | globals,
31 | },
32 | {
33 | banner,
34 | file: `${pkg.main.replace('.js', '')}.min.js`,
35 | format: 'umd',
36 | name: 'tempusDominus',
37 | globals,
38 | plugins: [terser()],
39 | },
40 | {
41 | banner,
42 | file: `${pkg.module.replace('.js', '')}.min.js`,
43 | format: 'es',
44 | name: 'tempusDominus',
45 | globals,
46 | plugins: [terser()],
47 | },
48 | ],
49 | external: ['@popperjs/core'],
50 | plugins: [
51 | typescript({
52 | tsconfig: (resolvedConfig) => ({
53 | ...resolvedConfig,
54 | }),
55 | }),
56 | ],
57 | },
58 | {
59 | input: 'dist/js/jQuery-provider.js',
60 | output: [
61 | {
62 | file: 'dist/js/jQuery-provider.min.js',
63 | },
64 | ],
65 | plugins: [terser()],
66 | },
67 | {
68 | input: 'src/scss/tempus-dominus.scss',
69 | output: [
70 | {
71 | banner,
72 | file: 'dist/css/tempus-dominus.css',
73 | },
74 | ],
75 | plugins: [
76 | postcss({
77 | sourceMap: true,
78 | extract: true,
79 | }),
80 | ],
81 | },
82 | {
83 | input: 'src/scss/tempus-dominus.scss',
84 | output: [
85 | {
86 | banner,
87 | file: 'dist/css/tempus-dominus.min.css',
88 | },
89 | ],
90 | plugins: [
91 | postcss({
92 | extract: true,
93 | minimize: true,
94 | }),
95 | ],
96 | },
97 | ];
98 |
--------------------------------------------------------------------------------
/build/serve.js:
--------------------------------------------------------------------------------
1 | const { ParvusServer } = require('@eonasdan/parvus-server');
2 |
3 | new ParvusServer({
4 | port: 3001,
5 | directory: `./docs`,
6 | middlewares: [],
7 | })
8 | .startAsync()
9 | .then();
10 |
--------------------------------------------------------------------------------
/build/utilities.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs').promises;
2 | const { dirname } = require('path');
3 |
4 | class Utilities {
5 | static async copyFileAndEnsurePathExistsAsync(file) {
6 | await fs.mkdir(dirname(file.destination), { recursive: true });
7 |
8 | await fs.copyFile(file.source, file.destination);
9 | }
10 |
11 | static async copy() {
12 | for (const file of [
13 | {
14 | source: './src/js/jQuery-provider.js',
15 | destination: './dist/js/jQuery-provider.js',
16 | },
17 | ]) {
18 | console.log(`copying ${file.source} to ${file.destination}`);
19 | await Utilities.copyFileAndEnsurePathExistsAsync(file);
20 | }
21 | }
22 |
23 | static async removeFileAsync(filePath) {
24 | if (!(await fs.stat(filePath)).isFile()) return;
25 | try {
26 | await fs.unlink(filePath);
27 | } catch (e) {}
28 | }
29 |
30 | static async removeDirectoryAsync(directory, removeSelf = true) {
31 | try {
32 | await fs.rm(directory, { recursive: true, force: true });
33 |
34 | if (!removeSelf) await fs.mkdir(dirname(directory), { recursive: true });
35 | } catch (e) {
36 | console.error(e);
37 | }
38 | }
39 | }
40 |
41 | const args = process.argv.slice(2);
42 |
43 | switch (args[0]) {
44 | case '--copy':
45 | console.log('Copying files');
46 | Utilities.copy().then();
47 | break;
48 | case '--clean':
49 | console.log('Cleaning path: ', args[1]);
50 | Utilities.removeDirectoryAsync(args[1]).then();
51 | break;
52 | }
53 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": {
3 | "name": "Jonathan Peterson"
4 | },
5 | "name": "@eonasdan/tempus-dominus",
6 | "version": "6.10.3",
7 | "style": "dist/css/tempus-dominus.css",
8 | "sass": "scss/tempus-dominus.scss",
9 | "main": "dist/js/tempus-dominus.js",
10 | "module": "dist/js/tempus-dominus.esm.js",
11 | "types": "types/tempus-dominus.d.ts",
12 | "files": [
13 | "dist/**/*",
14 | "src/js/**/*.ts",
15 | "src/js/locales/**/*.ts",
16 | "src/js/plugins/**/*.ts",
17 | "src/scss/**/*.scss",
18 | "types/**/*"
19 | ],
20 | "scripts": {
21 | "start": "npm run build && concurrently \"npm:*-watch\"",
22 | "test": "vitest --ui",
23 | "test:silent": "vitest --run --silent",
24 | "test:coverage": "vitest run --coverage",
25 | "serve": "node ./build/serve.js",
26 | "clean": "node ./build/utilities.js --clean ./dist && node ./build/utilities.js --clean ./types",
27 | "build": "npm run clean && node ./build/utilities.js --copy && npm run rollup && npm run build:declarations && npm run build:plugins-and-locales",
28 | "build:plugins": "node ./build/plugins.js -p",
29 | "build:locales": "node ./build/plugins.js -l",
30 | "build:plugins-and-locales": "node ./build/plugins.js",
31 | "build:declarations": "node ./build/utilities.js --clean ./types && tsc --declaration --emitDeclarationOnly --outDir types",
32 | "sass": "sass src/scss/tempus-dominus.scss ./dist/css/tempus-dominus.css",
33 | "rollup": "rollup -c ./build/rollup.config.js",
34 | "rollup-watch": "rollup -c ./build/rollup.config.js -w",
35 | "docs": "node ./src/docs/make.js",
36 | "docs-watch": "node ./src/docs/make.js --watch",
37 | "release": "npm run eslint && npm run test:silent && npm run build",
38 | "version": "node build/change-version.js",
39 | "prepare": "husky install",
40 | "prettier": "prettier --ignore-unknown --write .",
41 | "eslint": "npm run prettier && npx eslint --ext .html,.ts ."
42 | },
43 | "lint-staged": {
44 | "**/*!(.d)/.ts": [
45 | "npm run eslint"
46 | ],
47 | "**/*": [
48 | "npm run prettier"
49 | ]
50 | },
51 | "bugs": {
52 | "url": "https://github.com/eonasdan/tempus-dominus/issues"
53 | },
54 | "peerDependencies": {
55 | "@popperjs/core": "^2.11.6"
56 | },
57 | "peerDependenciesMeta": {
58 | "@popperjs/core\"": {
59 | "optional": true
60 | }
61 | },
62 | "description": "A robust and powerful date/time picker component. For usage, installation and demos see Project Site on GitHub",
63 | "devDependencies": {
64 | "@eonasdan/parvus-server": "^1.2.1",
65 | "@popperjs/core": "^2.11.6",
66 | "@rollup/plugin-node-resolve": "^14.1.0",
67 | "@types/node": "^18.14.2",
68 | "@typescript-eslint/eslint-plugin": "^5.54.0",
69 | "@typescript-eslint/parser": "^5.54.0",
70 | "@vitest/coverage-c8": "^0.29.2",
71 | "@vitest/ui": "^0.29.2",
72 | "bootstrap": "^5.2.3",
73 | "chokidar": "^3.5.3",
74 | "clean-css": "^5.3.2",
75 | "concurrently": "^7.6.0",
76 | "dropcss": "^1.0.16",
77 | "eslint": "^8.35.0",
78 | "eslint-config-prettier": "^8.6.0",
79 | "glob": "^7.2.3",
80 | "globby": "^11.1.0",
81 | "html-minifier-terser": "^5.1.1",
82 | "husky": "^8.0.3",
83 | "jsdom": "^20.0.3",
84 | "lint-staged": "^13.1.2",
85 | "prettier": "^2.8.4",
86 | "rollup": "^2.79.1",
87 | "rollup-plugin-ignore": "^1.0.10",
88 | "rollup-plugin-postcss": "^4.0.2",
89 | "rollup-plugin-terser": "^7.0.2",
90 | "rollup-plugin-ts": "^3.2.0",
91 | "sass": "^1.58.3",
92 | "terser": "^5.16.5",
93 | "tslib": "^2.5.0",
94 | "typescript": "~4.9.5",
95 | "vitest": "^0.29.2",
96 | "vitest-github-actions-reporter": "^0.10.0"
97 | },
98 | "homepage": "https://getdatepicker.com/",
99 | "keywords": [
100 | "datepicker",
101 | "datetimepicker",
102 | "timepicker"
103 | ],
104 | "license": "MIT",
105 | "repository": {
106 | "type": "git",
107 | "url": "https://github.com/Eonasdan/tempus-dominus.git"
108 | },
109 | "wallaby": {
110 | "filesWithNoCoverageCalculated": [
111 | "test/fixtures/**/*"
112 | ]
113 | },
114 | "funding": "https://ko-fi.com/eonasdan"
115 | }
116 |
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | sonar.organization=eonasdan
2 | sonar.projectKey=Eonasdan_tempus-dominus
3 |
4 | sonar.projectName=tempus-dominus
5 | sonar.projectVersion=6.9.4
6 |
7 | sonar.sources = src/
8 | sonar.tests = test/
9 |
--------------------------------------------------------------------------------
/src/docs/assets/24hour.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/24hour.png
--------------------------------------------------------------------------------
/src/docs/assets/buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/buttons.png
--------------------------------------------------------------------------------
/src/docs/assets/calendar-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/calendar-view.png
--------------------------------------------------------------------------------
/src/docs/assets/calendar-weeks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/calendar-weeks.png
--------------------------------------------------------------------------------
/src/docs/assets/date-range.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/date-range.png
--------------------------------------------------------------------------------
/src/docs/assets/decade-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/decade-view.png
--------------------------------------------------------------------------------
/src/docs/assets/metronic-thumb-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/metronic-thumb-1.png
--------------------------------------------------------------------------------
/src/docs/assets/metronic-thumb-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/metronic-thumb-2.png
--------------------------------------------------------------------------------
/src/docs/assets/metronic-thumb-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/metronic-thumb-3.png
--------------------------------------------------------------------------------
/src/docs/assets/month-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/month-view.png
--------------------------------------------------------------------------------
/src/docs/assets/side-by-side.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/side-by-side.png
--------------------------------------------------------------------------------
/src/docs/assets/time-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/time-view.png
--------------------------------------------------------------------------------
/src/docs/assets/toolbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/toolbar.png
--------------------------------------------------------------------------------
/src/docs/assets/year-view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Eonasdan/tempus-dominus/5a81b754dd37925a83c28762ff1afb3b53114bfd/src/docs/assets/year-view.png
--------------------------------------------------------------------------------
/src/docs/js/docs.js:
--------------------------------------------------------------------------------
1 | document.addEventListener('DOMContentLoaded', () => {
2 | const subToc = document.getElementById('subToc');
3 |
4 | if (subToc) {
5 | document.getElementById('tocContents').innerHTML = subToc.innerHTML;
6 | document.getElementById('tocContainer').classList.remove('d-none');
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/src/docs/partials/datetime.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | In v6 I dropped moment as a required library since it is no longer recommended. Almost all the functions in the
4 | picker make use of my custom DateTime class which extends the native Date object.
5 |
6 |
7 | Because I am simply extending the native date object, any returned values will still behave like a date object.
8 | Which means you don't need to adopt using DateTime in your project unless you want to. Once less library to worry about!
9 |
10 |
11 |
12 |
13 |
DateTime
14 |
07/08/2021
15 |
07/08/2021
16 |
Custom date extension object
17 |
datepicker, javascript, open source, tempus dominus, eonasdan
Namespace.events.hide - if the widget is hidden after the toggle call
46 |
47 |
48 |
Namespace.events.show - if the widget is show after the toggle call
49 |
50 |
51 |
Namespace.events.change - if the widget is opened for the first time and the
52 | input element
53 | is empty and options.useCurrent != false
54 |
55 |
56 |
57 |
58 |
59 |
show
60 |
62 |
Shows the widget
63 |
Emits
64 |
65 |
66 |
Namespace.events.show - if the widget was hidden before that call
67 |
68 |
69 |
Namespace.events.change - if the widget is opened for the first time and the
70 | useCurrent is set to true or to a granularity value and the input element the
71 | component is
72 | attached to has an empty value
73 |
74 |
75 |
76 |
77 |
78 |
hide
79 |
81 |
Hides the widget
82 |
Emits
83 |
84 |
Namespace.events.hide - if the widget was visible before that call
91 | Allows developers to add/remove classes from an element. During the grid generation code, this function is called.
92 |
93 |
94 | It provides the unit that is being generated (i.e. displaying the main date view), the date time object
95 | being effected, the current set of css classes and the container element.
96 |
4 | Tempus Dominus is the successor to the very popular "eonasdan/bootstrap-datetimepicker". The plugin provides a wide array of options that allow developers to provide date and or time selections to users as simple pickers, date of birth selection, appointments and more.
5 |
6 |
7 | If you're looking for installation instructions check out the download page.
8 |
9 |
10 | Once you get it installed there are plenty of examples and a stackblitz.
11 |
4 | No matter how you choose to get the files, make sure that Popper is include before the picker's main script file.
5 |
6 |
7 | You will also want a font library. The picker defaults to Font Awesome 6, but you can provide a different icon set
8 | via the configuration or a plugin.
9 |
4 | Version 6 defaults to FA 5 icons (but will switch to FA 6 when that's released), removes moment, jQuery and
5 | Bootstrap as depedencies. It also uses Popper.js v2.
6 |
7 |
8 | This tool attempts to convert your configurations from previous version of the picker to v6. Paste your current
9 | configuration into the input box. Due to how this process works, it cannot convert usages of moment or date
10 | objects. Set any property that uses unsupported values to undefined so that configuration can still
11 | be converted.
12 |
13 |
14 | For more information on what's changed, check out the change log.
15 |
16 |
17 | If you find a bug or your configuration doesn't work, please open an issue.
18 |
19 |
20 |
21 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | You can try your settings out here. If you're using an old version of FA or a differnt icon family, the icons
75 | won't show.
76 |
77 |
78 |
79 |
80 |
81 |
82 |
88 |
94 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
Exception 1
106 |
107 | Moment is no longer used or an accepted value for configurations. You can either change the config to use the
108 | value of undefined or remove the configuration. There's just no way I could convert
109 | every possible way to use moment into something that works for the new version.
110 |
111 |
Exception 2
112 |
113 | The current process doesn't work well with functions or object initalizers. You will have to replace those
114 | calls. If you have a suggestions on how to improve this, please let me know.
115 |
116 |
117 |
118 |
119 |
120 |
Migration
121 |
07/08/2021
122 |
07/08/2021
123 |
How to use Tempus Dominus datetime picker
124 |
datepicker, javascript, open source, tempus dominus, eonasdan
4 | These events may provide additional details. For native javascript you can
5 | get this data via e.details.*. For jQuery the details are directly in the event, e.g.
6 | e.date
7 |
8 |
9 | Each of these events inherit from the BaseEvent interface.
10 |
5 | By default, @popperJS/core is required for the popper to work correctly. Alternatively, we can remove popper and
6 | use
7 | FloatingUI by creating a
8 | plugin that handles the popup creation.
9 |
5 | Plugins allow you to extend the picker by adding new functionality to either Tempus Dominus globally,
6 | a single picker or by overwriting existing functionality.
7 |
8 |
9 |
10 |
11 |
Creating plugins
12 |
13 | There are a few examples in the source like this
14 |
92 | The code above would affect a single picker but not globally. You could easily adapt this code to
93 | have a common formatting function taking in a format string.
94 |
95 |
96 |
97 |
98 |
106 |
107 |
108 |
109 |
110 |
111 |
Plugins
112 |
01/19/2022
113 |
02/05/2022
114 |
How to use plugins with Tempus Dominus.
115 |
datepicker, javascript, open source, tempus dominus, eonasdan
4 | If you still need to use moment.js, you can load this plugin to use moment to parse input dates.
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
26 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
40 |
41 |
45 |
46 |
47 | //example picker
48 | //note that you can optionally provide the format to use.
49 | tempusDominus.extend(tempusDominus.plugins.moment_parse, 'DD.MM.yyyy hh:mm a');
50 | const datetimepicker1 = new tempusDominus.TempusDominus(document.getElementById('datetimepicker1'));
51 |
52 |
53 |
54 |
55 |
How it works
56 |
57 | This plugin overrides two picker functions setFromInput and formatInput.
58 |
59 |
60 | setFromInput parses and sets a date at the provided index with the textbox value.
61 |
62 |
63 | formatInput is the reverse, it takes a date time object and formats or parses it to a string.
64 |
4 | You can customize the css classes applied to dates by overwriting the display.paint.
5 | The function provides a Unit value (extended to include "decade"),
6 | the date involved and an array of string that represents the classes that will be applied.
7 |