Skip to content

Commit

Permalink
Merge pull request #166 from vigoren/develop
Browse files Browse the repository at this point in the history
v1.3.8
  • Loading branch information
vigoren authored Jul 16, 2021
2 parents b690cad + 9db7b52 commit 2118d3c
Show file tree
Hide file tree
Showing 47 changed files with 305 additions and 130 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## v1.3.8 - Bug Fixes

### Quality of Life Improvements

- Changed the moon icons to a new set of SVG's. This will make the creation of Calendar themes easier in the future.

### Bug Fixes

- Fixed a bug for the DSA5 system where the save configuration button would float in the middle of the content.
- Fixed a bug where linked items (Journals, Tables, Macros, etc...) in notes were not linking properly.
- Fixed a bug where you were unable to set a note end time to be less than the start time for notes that spanned multiple days.
- Fixed a bug when converting seconds to a date where months with 0 days for that year were not skipped.
- Fixed a bug when calculating the seconds for a date for calendars with a "Leap Month" (A month with 0 days normally but days during a leap year) that had more than one day. The calendar would incorrectly advance by the number of days in that leap month.
- Fixed a bug where months were unable to have 0 leap year days.
- Fixed a bug where the moon calculation could occasionally say every day of a month was the same moon phase.

## v1.3.0 - Note Improvements

### Notes
Expand Down
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@

# Simple Calendar

A simple calendar module for [FoundryVTT](https://foundryvtt.com/) that is system independent.
A simple calendar module for [FoundryVTT](https://foundryvtt.com/) that is game system independent.

This module allows you to create a calendar with any number of months per year, any number of days per month and customizable hours, minutes and seconds for your game world.
It is intended as a way for a GM to show a calendar like interface that maps to their in game world.
This module allows you to create a completely customizable calendar that ties in with the Game Masters world exactly how they want it to. Notes and events can be added to the calendar to help keep track of what and when things are happening in your world.

All of this is done using a familiar calendaring view both the GM and players will enjoy!

## Contents

- [Features](#features)
- [Installation](#installing-the-module)
- [Compatible Modules](#compatible-modules)
- [Accessing and using the calendar](./docs/UsingTheCalendar.md)
- [Configuring your Calendar](./docs/Configuration.md)
- [Changing the date and time](./docs/UpdatingDateTime.md)
- [Notes](./docs/Notes.md)
- [Hooks](./docs/Hooks.md)
- [API (For other modules and systems)](./docs/API.md)
- [API (For use by other modules, systems or macros)](./docs/API.md)
- [Translations](#translations)

## Features
Expand Down Expand Up @@ -70,25 +69,21 @@ It is intended as a way for a GM to show a calendar like interface that maps to

## Installing The Module

There are 2 ways to install the module, using the module.json file or by manually downloading the zip file.
There are 3 ways to install the module:

### Through Foundry

Foundry has a built-in directory of modules that you can install. The easiest way is to use this feature and search for "Simple Calendar" and install!

### module.json

To install using the module json file, use this link [https://github.com/vigoren/foundryvtt-simple-calendar/releases/latest/download/module.json](https://github.com/vigoren/foundryvtt-simple-calendar/releases/latest/download/module.json)
Through the same built-in module installer in foundry, you can specify the link of the module to install instead of searching the directory. To install using the module json file, use this link [https://github.com/vigoren/foundryvtt-simple-calendar/releases/latest/download/module.json](https://github.com/vigoren/foundryvtt-simple-calendar/releases/latest/download/module.json)

### Zip File

To install the most recent version of the module, view the releases section to the right of the main GitHub page.
Selecting the latest release will bring you to a page where you can download the module.zip asset. This will contain everything you need to manually install the module.

## Compatible Modules
These are other time keeping modules that Simple Calendar can work if they are installed in your world.

**Important**: None of these modules are required, the option to work with them is available to make a GMs life easier if they want to use Simple Calendar but have another of these modules installed.

- [about-time](https://foundryvtt.com/packages/about-time): See the [about-time module configuration for Simple Calendar](./docs/Configuration.md#about-time) for more information.
- [Calendar/Weather](https://foundryvtt.com/packages/calendar-weather): See the [Calendar/Weather module configuration for Simple Calendar](./docs/Configuration.md#calendarweather) for more information.

## Translations

Simple Calendar is available in languages other than English thanks to the following people:
Expand All @@ -113,4 +108,4 @@ If your language is missing from the list, and you would like to help translate

## Credits

Moon Icons by [Wolf Böse](https://thenounproject.com/neuedeutsche/)
Moon Icons by [Bas Milius](https://github.com/basmilius/weather-icons), modified by [vigorator](https://github.com/vigoren)
4 changes: 4 additions & 0 deletions __mocks__/text-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class TE {
on(a: string, b: Function){
this.changeResult = b;
}

enrichHTML(){

}
}

//@ts-ignore
Expand Down
4 changes: 4 additions & 0 deletions custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any;
export default content;
}
36 changes: 23 additions & 13 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Gregorian|This the standard real life calendar|The current date will be used
Dark Sun |This is the calendar from the Sark Sun setting for Dungeons and Dragons|Scorch 1,1
Eberron| This is the calendar from the Eberron setting for Dungeons and Dragons | Zarantyr 1, 998 YK
Exandrian |This is the calendar from the Exandria setting for Dungeons and Dragons | Horisal 1, 812 P.D.
Forgotten Realms: Harptos | This is the calendar used across Faerun in the Forgotten Realms | Hammer 1, 1495 DR
Golarian: Pathfinder 1E | This is the calendar from the Pathfinder 1E game | Abadius 1, 4710 AR
Golarian: Pathfinder 2E | This is the calendar from the Pathfinder 2E game | Abadius 1, 4710 AR
Greyhawk | This is the calendar from the Greyhawk setting for Dungeons and Dragons | Needfest 1, 591 cy
Harptos | This is the calendar used across Faerun in the Forgotten Realms | Hammer 1, 1495 DR
Traveller: Imperial Calendar|This is the Imperial calendar used for the Traveller game system|1, 1000
Warhammer | This is the calendar used by the Imperium in the Fantasy Warhammer game | Hexenstag 1, 2522
Warhammer: Imperial Calendar | This is the calendar used by the Imperium in the Fantasy Warhammer game | Hexenstag 1, 2522

All of these calendars can be further customized after they are loaded. They are here to provide a simple starting point for your game.

Expand All @@ -33,12 +33,12 @@ These settings dictate how Simple Calendar interacts with Foundry's game world t

Option|Description|Update Game World Time|When Game World Time is Updated
--------|--------------------|-------------------------------------------------|----------------------------------------------------------
None (default)|Simple Calendar does not interact with the game world time at all. This setting is ideal if you want to keep Simple Calendar isolated from other modules.|Does not update the game world time|Simple Calendar is not updated when the game world time is updated by something else.
None|Simple Calendar does not interact with the game world time at all. This setting is ideal if you want to keep Simple Calendar isolated from other modules.|Does not update the game world time|Simple Calendar is not updated when the game world time is updated by something else.
Self|Treats Simple Calendar as the authority source for the game world time. This setting is ideal when you want Simple Calendar to be in control of the games time and don't want other modules updating Simple Calendar|Updates the game world time to match what is in Simple Calendar.|Combat round changes will update Simple Calendars time. Simple Calendar will ignore updates from all others modules.
Third Party Module|This will instruct Simple Calendar to just display the Time in the game world time. All date changing controls are disabled and the changing of time relies 100% on another module. This setting is ideal if you are just want to use Simple Calenar to display the date in calendar form and/or take advantage of the notes.|Does not update the game world time.|Updates it's display everytime the game world time is changed, following what the other modules say the time is.
Mixed|This option is a blend of the self and third party options. Simple calendar can change the game world time and and changes made by other modules are reflected in Simple Calendar. This setting is ideal if you want to use Simple Calendar and another module to change the game time.|Will update the game world time|Will update it's own time based on changes to the game world time, following what other modules say the time is.
Mixed (default)|This option is a blend of the self and third party options. Simple calendar can change the game world time and and changes made by other modules are reflected in Simple Calendar. This setting is ideal if you want to use Simple Calendar and another module to change the game time.|Will update the game world time|Will update it's own time based on changes to the game world time, following what other modules say the time is.

The most common interaction with another module is likely to be with Calendar/Weather. For this module I recommend using the "Self" or "Mixed" setting. With self weather effects will still trigger from Calendar/Weather as you advance time in Simple Calendar. Only use mixed if you also want to be able to use the Calendar/Weather controls to advance time to certain points (like dawn or dusk).
Mixed is the best option to ensure compatibility with any other modules that interact with game time.

### Pathfinder 2E: World Clock Sync
For games running the Pathfinder 2E system, this setting will attempt to keep Simple Calendars date and time in sync with the Pathfinder 2E's World Clock.
Expand All @@ -55,6 +55,7 @@ Permission|Description|Roles
----------|------------|----
View Calendar | If users in this role can view the calendar interface or not.|Player, Trusted Player, Assistant GM
Add Notes | If users in these roles are able to add notes to the calendar.|Player, Trusted Player, Assistant GM
Reorder Notes| If users in these roles are able to reorder notes on a specific day.|Player, Trusted Player, Assistant GM
Change Date and Time| If users in these roles are able to change the calendars date and time.|Player, Trusted Player, Assistant GM

### Import/Export
Expand All @@ -71,13 +72,13 @@ The current supported modules for importing/exporting settings:

#### about-time

The [about-time](https://foundryvtt.com/packages/about-time) module is used for many other modules but can also be used on its own.
The [about-time](https://foundryvtt.com/packages/about-time) module as of v1.0.0 now depends on Simple Calendar for its calendaring functionality.

Settings can be imported and exported between these two modules without issue.
For help with updating to this version the settings from about-time can be imported into Simple Calendar.

#### Calendar/Weather

The [Calendar/Weather](https://foundryvtt.com/packages/calendar-weather) module is used as a way to integrate about-time with a custom calendar and additional weather effects.
The [Calendar/Weather](https://foundryvtt.com/packages/calendar-weather) module is currently going under a large re-write (v4) that will integrate with Simple Calendar for all calendar functionality and provide weather functionality for it.

Most settings can be imported and exported between these two modules with these notable exceptions:

Expand All @@ -93,12 +94,21 @@ Most settings can be imported and exported between these two modules with these

This tab contains the settings for creating and interacting with notes.

Setting | Description
-------- | ----------
Note Default Player Visibility | For new notes, if by default the player visibility option is checked or not.
Players Can Add Notes | If checked players will be allowed to add their own notes to the calendar.
Players Can Re-Order Notes | If checked players will be allowed to re-order the notes on a day.
### Note Default Player Visibility

For new notes, if by default the player visibility option is checked or unchecked.

### Note Categories

This section is used to specify any custom categories for notes.

Category Setting|Description
----------------|------------
Note Category Name| This is the name used to identify the custom category. Also used as the display text for the category.
Note Category Color| The color associated with the category. Used as the background color for the category.
Remove| Removes the note category from the list.
Add Note Category| Adds a new note category to the list.
Remove All Note Categories|Removes all note categories.

## Year Settings

Expand Down
2 changes: 1 addition & 1 deletion docs/Macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Here are all the exposed functions that can be used when creating a macro.

## Open Simple Calendar
This macro has been depreciated. Please use the new [showCalendar](./API.md#simplecalendarapishowcalendardate) function.
This macro has been depreciated. Please use the new [showCalendar](./API.md#simplecalendarapishowcalendardate-compact) function.

## Set Date and Time
This macro has been depreciated. Please use the new [setDate](./API.md#simplecalendarapisetdatedate) function.
Expand Down
17 changes: 17 additions & 0 deletions docs/UsingTheCalendar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Accessing and Using the Calendar

To access the calendar, a button has been added under the Token Controls left menu.

![Calendar Button Location](./images/calendar-button.png)













The module adds a calendar button to the basic controls section of the layer controls. Clicking on this will open the module window

![Calendar Button Location](https://raw.githubusercontent.com/vigoren/foundryvtt-simple-calendar/main/docs/images/layers-button.png)
Expand Down
Binary file added docs/images/calendar-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const config: Config.InitialOptions = {
moduleFileExtensions: ["js", "jsx", "json", "node", "ts"],
testEnvironment: 'node',
testMatch: [ "**/?(*.)+(spec|test).+(ts|tsx|js)" ],
transform: {"^.+\\.(ts|tsx)$": "ts-jest"},
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
"^.+\\.svg$": "jest-transform-stub"
},
collectCoverage: true,
coverageDirectory: './docs/coverage'
};
Expand Down
39 changes: 10 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "foundryvtt-simple-calendar",
"description": "A simple calendar module for keeping track of game days and events.",
"version": "1.3.0",
"version": "1.3.8",
"author": "Dean Vigoren (vigorator)",
"keywords": [
"foundryvtt",
Expand Down Expand Up @@ -30,8 +30,9 @@
"@types/node": "^16.3.0",
"copy-webpack-plugin": "^9.0.1",
"cross-env": "^7.0.3",
"css-loader": "^5.2.7",
"css-loader": "^6.0.0",
"jest": "^27.0.6",
"jest-transform-stub": "^2.0.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"mini-css-extract-plugin": "^2.1.0",
"sass": "^1.35.2",
Expand Down
13 changes: 13 additions & 0 deletions src/classes/date-selector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,14 +754,27 @@ describe('Date Selector Class Tests', () => {
ds.selectedDate.startDate.minute = 59;
ds.timeUpdate(event);
expect(updateSpy).toHaveBeenCalledTimes(7);
expect(ds.selectedDate.endDate.hour).toBe(23);
expect(ds.selectedDate.endDate.minute).toBe(59);

ds.selectedDate.startDate.minute = 0;
ds.timeUpdate(event);
expect(updateSpy).toHaveBeenCalledTimes(8);
expect(ds.selectedDate.endDate.hour).toBe(23);
expect(ds.selectedDate.endDate.minute).toBe(0);

(<HTMLInputElement>event.currentTarget).value = '1:1';
ds.selectedDate.startDate.hour = 0;
ds.timeUpdate(event);
expect(updateSpy).toHaveBeenCalledTimes(9);
expect(ds.selectedDate.endDate.hour).toBe(1);
expect(ds.selectedDate.endDate.minute).toBe(1);

ds.selectedDate.startDate.hour = 10;
ds.selectedDate.endDate.day = 10;
ds.timeUpdate(event);
expect(updateSpy).toHaveBeenCalledTimes(10);
expect(ds.selectedDate.endDate.hour).toBe(1);
expect(ds.selectedDate.endDate.minute).toBe(1);
});
});
Loading

0 comments on commit 2118d3c

Please sign in to comment.