diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2022-04-30 11:08:19 -0400 |
|---|---|---|
| committer | tusooa <tusooa@kazv.moe> | 2023-01-20 23:40:11 -0500 |
| commit | 228a9afdf5ecc10a17de31f88bd88ad1efbe0004 (patch) | |
| tree | de4b33705c4e9b4f3fb12f6c5ad26b08f8261566 /src/components/poll | |
| parent | 95c15fca225d989613a50a6039c8ffa809a8fd88 (diff) | |
Add timed-mute functionality
Diffstat (limited to 'src/components/poll')
| -rw-r--r-- | src/components/poll/poll_form.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/components/poll/poll_form.js b/src/components/poll/poll_form.js index e30645c3..a2070155 100644 --- a/src/components/poll/poll_form.js +++ b/src/components/poll/poll_form.js @@ -94,19 +94,10 @@ export default { }, convertExpiryToUnit (unit, amount) { // Note: we want seconds and not milliseconds - switch (unit) { - case 'minutes': return (1000 * amount) / DateUtils.MINUTE - case 'hours': return (1000 * amount) / DateUtils.HOUR - case 'days': return (1000 * amount) / DateUtils.DAY - } + return DateUtils.secondsToUnit(unit, amount) }, convertExpiryFromUnit (unit, amount) { - // Note: we want seconds and not milliseconds - switch (unit) { - case 'minutes': return 0.001 * amount * DateUtils.MINUTE - case 'hours': return 0.001 * amount * DateUtils.HOUR - case 'days': return 0.001 * amount * DateUtils.DAY - } + return DateUtils.unitToSeconds(unit, amount) }, expiryAmountChange () { this.expiryAmount = |
