mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 20:43:52 -06:00
utc time support
This commit is contained in:
parent
5c3cc0e71e
commit
9024ec0945
14
README.MD
14
README.MD
@ -125,6 +125,18 @@ Array of timeframes that allows to override options based on local time. See exa
|
||||
```json
|
||||
[]
|
||||
```
|
||||
###### Timeframe format
|
||||
```javascript
|
||||
{
|
||||
"name": "friendly name", // a friendly name visible in the logs
|
||||
"start": "12:00", // timeframe start time <hour>:<minutes>
|
||||
"end": "18:00", // timeframe end time <hour>:<minutes>
|
||||
"utcTime": true, // true: use UTC time; false: use LOCAL time
|
||||
"overrides": {
|
||||
"automaticVoteStart": false
|
||||
}
|
||||
},
|
||||
```
|
||||
### Example configuration
|
||||
```json
|
||||
{
|
||||
@ -149,6 +161,7 @@ Array of timeframes that allows to override options based on local time. See exa
|
||||
"name": "follow layer rotation list",
|
||||
"start": "12:00",
|
||||
"end": "18:00",
|
||||
"utcTime": true,
|
||||
"overrides": {
|
||||
"automaticVoteStart": false
|
||||
}
|
||||
@ -156,6 +169,7 @@ Array of timeframes that allows to override options based on local time. See exa
|
||||
{
|
||||
"start": "22:00",
|
||||
"end": "02:00",
|
||||
"utcTime": false,
|
||||
"overrides": {
|
||||
"voteBroadcastMessage": "Late night games? Vote your favourite map!"
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
this.updateNextMap();
|
||||
}
|
||||
async timeframeOptionOverrider() {
|
||||
const timeNow = new Date(0, 0, 0, new Date().getHours(), new Date().getMinutes());
|
||||
const activeTimeframes = this.or_options.timeFrames.filter(tfFilter);
|
||||
|
||||
let logTimeframe = "Active Time Frames: ";
|
||||
@ -191,6 +190,8 @@ export default class MapVote extends DiscordBasePlugin {
|
||||
this.verbose(1, logTimeframe + activeTfIds.join(', '));
|
||||
|
||||
function tfFilter(tf, key, arr) {
|
||||
const timeNow = tf.utcTime?new Date(0, 0, 0, new Date().getUTCHours(), new Date().getUTCMinutes()):new Date(0, 0, 0, new Date().getHours(), new Date().getMinutes());
|
||||
|
||||
arr[ key ].id = key + 1;
|
||||
const tfStartSplit = [ parseInt(tf.start.split(':')[ 0 ]), parseInt(tf.start.split(':')[ 1 ]) ];
|
||||
const tfEndSplit = [ parseInt(tf.end.split(':')[ 0 ]), parseInt(tf.end.split(':')[ 1 ]) ];
|
||||
|
Loading…
x
Reference in New Issue
Block a user